Last post Nov 22, 2011 04:40 AM by Nishantg
Nov 18, 2011 01:25 AM|Marko_|LINK
I have a problem with creating reportviewer dynamically, on my page load even existing code works, but on button click not,any ideas why is this happening?Here is my code:
Dim Report As New ReportViewer Report.ProcessingMode = ProcessingMode.Local Report.LocalReport.ReportPath = Server.MapPath("Reports\Report.rdlc") Dim DataSet1 As New ReportDataSource DataSet1.Name = "DataSet1" DataSet1.DataSourceId = "ObjectDataSource1" Dim Dataset2 As New ReportDataSource Dataset2.Name = "DataSet2" Dataset2.DataSourceId = "ObjectDataSource2"
ObjectDataSource1.SelectParameters("param1").DefaultValue = "value1"
ObjectDataSource1.SelectParameters("param2").DefaultValue = "value2"
ObjectDataSource1.SelectParameters("param3").DefaultValue = "value2"
Report.LocalReport.DataSources.Add(DataSet1) Report.LocalReport.DataSources.Add(Dataset2) Report.LocalReport.Refresh()
Thank's for replay
Nov 19, 2011 06:40 AM|Srikanth Kasturi|LINK
Please refer this:
Nov 21, 2011 04:32 AM|Nishantg|LINK
If your code is working from PageLoad event it should also work with ButtonClick event. Please chec your code in ButtonClick and if its giving you error please explain it that what kind of error you are getting.
Nov 22, 2011 12:13 AM|Marko_|LINK
There is no error on button click event,and the code is same as on page load event. Maybe is something wrong with binding report, because button click shows empty reportviewer...
Nov 22, 2011 04:40 AM|Nishantg|LINK
Please check your value which are getting passed when you are using the button click event. To do so you can take a text box and call your parameter value and then try to see if the value displaying in your report is working with the query in database directly.
Like this you need to find out the problem. Because there is no difference in calling a code from PageLoad and button click.
I hope this will help you.