Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi everybody i have a doubt in crystal reports. while running a website it's shows a report depends on the value selected in the dropdownlist but when the crystal reports loads into the page,dropdownlist goes to the bottom of the page.i want to place the dropdownlist in the top itself to choose another report without scrollin the curernt page.if you know pls let me learn:)
Posted
Comments
Toniyo Jackson 6-Sep-11 3:49am    
Share your code
Al Moje 6-Sep-11 3:59am    
Not clear question. could you provide a code?
raj ch 6-Sep-11 4:42am    
Create a table and place dropdownlist in one row and crystalreport viewer in another row.
U can use float in Style sheet.
still u didnt get post ur code
Saranpal 6-Sep-11 8:27am    
while running this code dropdownlist came to bottom of page...so how can i resize my crystal report.?

1 solution

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}

protected void D1_SelectedIndexChanged(object sender, EventArgs e)
{
string s = "data source=xxxx;User id=yyyy;password=zzz;Initial catalog=lab1";
SqlConnection con = new SqlConnection(s);
if(D1.SelectedValue.ToString()=="Projector Report")
{
DataTable dt = new DataTable();
DataSet1 ds = new DataSet1();

SqlCommand cmd = new SqlCommand("select * from projector");
cmd.Connection=con;
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
ds.Tables[0].Merge(dt);
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath("CrystalReport.rpt"));
rpt.SetDataSource(ds);
CrystalReportViewer1.ReportSource = rpt;
}
else
{
DataTable dt = new DataTable();
DataSet2 ds = new DataSet2();
SqlCommand cmd = new SqlCommand("select * from scanner_asset");
cmd.Connection = con;
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
ds.Tables[0].Merge(dt);
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath("c2.rpt"));
rpt.SetDataSource(ds);
CrystalReportViewer1.ReportSource = rpt;
}
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900