Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ay1585
Starting Member
1 Post |
Posted - 2010-01-22 : 02:14:02
|
Hi All, I am working with rdlc reports. I have an asp.net web form where i'll select a parameter (substance name)from a dropdown. When I click on view reports button, the report should open in a pop up. I am passing the ID(substance ID) from dropdown in query string to the popup page. When I click on view reports button, the report should open in a pop up. For this I have taken report viewer control in another aspx page. The code in the aspx.cs page which contains the report viewer control is as follows : I have taken two rdlc reports. The main report has the parameter SubstanceID. The child report has parameter substance name.When I click on one particular textbox in main report it should navigate to another report. So, in textbox properties of main report in Navigation tab,I am giving "jump to report"--child report name and parameters "@SubstanceName" and its Parametervalue as : =Fields!SubstanceName.Value. When I work out this report in server side reporting(ReportServerProject) it works as expected.But in coding it throws an error : An error occurred during local report processing.An attempt was made to set a report parameter '@SubstanceName' that is not defined in this report. I have taken a report viewer and two ObjectDataSources....one for parent report and other for child report. The code for the page that contains report viewer is as follows:In page Load : Binding Parent reportprotected void Page_Load(object sender, EventArgs e) { con = new SqlConnection(@" ................. "); con.Open(); if (!IsPostBack) { Hashtable parms = new Hashtable();//Parameter for parent report (comes from main page to pop up page in query string) parms.Add("@SubstanceID", Request.QueryString["Id"].ToString()); //SP name SqlDataAdapter da = new SqlDataAdapter("SampleSubReportSP", con); da.SelectCommand.CommandType = CommandType.StoredProcedure; if (parms.Count > 0) { foreach (DictionaryEntry de in parms) { da.SelectCommand.Parameters.AddWithValue(de.Key.ToString(), de.Value); } } DataSet ds = new DataSet(); da.Fill(ds); ReportDataSource datasource = new ReportDataSource("SIEFds_SampleSubReportSP", ObjectDataSource1); RVSIEF.LocalReport.DataSources.Clear(); RVSIEF.LocalReport.DataSources.Add(datasource); RVSIEF.LocalReport.Refresh(); } }//For child reportprotected void RVSIEF_Drillthrough(object sender, DrillthroughEventArgs e) { Hashtable parms1 = new Hashtable(); parms1.Add("@SubstanceName", Request.QueryString["SubName"].ToString()); SqlDataAdapter da1 = new SqlDataAdapter("SampleMyConsReportSP", con); da1.SelectCommand.CommandType = CommandType.StoredProcedure; if (parms1.Count > 0) { foreach (DictionaryEntry de in parms1) { da1.SelectCommand.Parameters.AddWithValue(de.Key.ToString(), de.Value); } } DataSet ds1 = new DataSet(); da1.Fill(ds1); con.Close(); ReportDataSource datasource1 = new ReportDataSource("MyConsDS_SampleMyConsReportSP", ObjectDataSource2); RVSIEF.LocalReport.DataSources.Add(datasource1); RVSIEF.LocalReport.Refresh(); } |
|
|
|
|
|
|