Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i created 2 reports 1 is billa4.rdlc and 2nd is billa5 i just want to load these two reports when user selects the options a4 or a5 . my current code is

Try
          Dim P2 As New ReportParameter("pbillnum", billnoprint)
          Me.DataTable1TableAdapter.Fill(Me.billdata.DataTable1, billnoprint)
          Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter() {P2})
          Me.ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout)
          Me.ReportViewer1.ZoomMode = ZoomMode.FullPage
          Me.ReportViewer1.RefreshReport()

      Catch ex As Exception
          MsgBox("error")
      End Try


here my billa4.rdlc is loading but i want a code so i can dynamically change the billa4 to billa5.rdlc .
Posted
Comments
virusstorm 12-May-15 11:06am    
All you need to do is when the selection in the drop down changes, fire an event that changes the report viewer source. If you let me know if this for an ASP.NET or forms application, I can provide an example.
yash00121 12-May-15 11:10am    
for vb.net
where to put the source .??
[no name] 26-May-15 6:13am    
where you put user control

1 solution

You could use
Me.ReportViewer1.LocalReport.LoadReportDefinition(stream)
to load the stream of the report
or use
Me.ReportViewer1.LocalReport.ReportPath(sPath)
to load from file


UPDATE:
Me.ReportViewer1.LocalReport.ReportPath = sPath
 
Share this answer
 
v2
Comments
yash00121 12-May-15 11:44am    
plz explain in detail
i am using this
Me.ReportViewer1.LocalReport.ReportPath(billa4.rdlc)
it is giving error
Manuele Camilletti 26-May-15 3:24am    
Excuse me, it is a property not a method
You must use:
Me.ReportViewer1.LocalReport.ReportPath = sPath
Then you must use Me.ReportViewer1.RefreshReport()

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