Click here to Skip to main content
15,908,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,

I am trying to pass parameter from a combo box to my rdlc report, below is my code:

C#
private void ReportData( string schname)
  {
      DataSet4TableAdapters.NotStartedRegTableAdapter ta = new     DataSet4TableAdapters.NotStartedRegTableAdapter( );
      DataSet4.NotStartedRegDataTable dt = new DataSet4.NotStartedRegDataTable( );
      ta.Fill( dt, schname );
      ReportDataSource rds = new ReportDataSource( );
      rds.Name = "DataSet4";
      rds.Value = dt;
      //Microsoft.Reporting.WinForms.ReportDataSource reportDataSource4 = new Microsoft.Reporting.WinForms.ReportDataSource( "DataSet4", dt.AsEnumerable( ).CopyToDataTable( ) );
      ReportParameter rp = new ReportParameter( "schoolName", schname );

      reportViewer1.LocalReport.DataSources.Clear( );
      reportViewer1.LocalReport.ReportPath = "Report4.rdlc";
      reportViewer1.LocalReport.SetParameters( new ReportParameter[] { rp } );
      reportViewer1.LocalReport.DataSources.Add( rds );
      reportViewer1.LocalReport.Refresh( );
  }


The calling method:
C#
ReportData(cboSchools.Text );

its not reporting any error, but the report is not loaded, is there anything i am missing?
Posted
Comments
King Fisher 17-May-14 8:51am    
have you
http://www.codeproject.com/Questions/209087/How-to-pass-textbox-Combobox-value-to-rdlc-report
Uwakpeter 22-May-14 3:28am    
i was able to resolve this myself, i added reportViewer1.LocalReport.Refresh( ); after the calling method, and it works! Thanks
King Fisher 22-May-14 3:32am    
good :)

1 solution

i was able to resolve this myself, i added reportViewer1.LocalReport.Refresh( ); after the calling method, and it works! Thanks
 
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