Last post Jun 08, 2011 01:05 AM by maygal
Jun 02, 2011 02:55 AM|maygal|LINK
<CR:CrystalReportSource ID="CrystalReportSource_view" runat="server">
Code behind : When choose report in dropdown and click button, the event as below
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
CrystalReportViewer1.ReportSource = "Report\" & DropDownList1.SelectedValue & ".rpt"
It works well, but when click print, it prints report "abc.rpt" and not the selected drop down report, but the selected drop down report does show in crystal report viewer.
Please assist. Thanks!
Jun 07, 2011 01:06 AM|Damon Liu - MSFT|LINK
you can change the CrystalReportViewer1.ReportSource = "Report\" & DropDownList1.SelectedValue & ".rpt" with CrystalReportViewer1.ReportSource = "Report\" + DropDownList1.SelectedValue +".rpt" ,then you will find the right path.
Jun 07, 2011 02:32 AM|maygal|LINK
Nope... The dropdown works, is just when I click "Print", it will print the previous report instead of the selected report.
Jun 07, 2011 10:24 PM|Damon Liu - MSFT|LINK
SelectedItem – refers to the selected dropdownlist ListItem options, read-only don’t write
SelectedValue – refers to the selected in the value of the dropdownlist for string options, read-only don’t write
so you can change DropDownList1.SelectedValue to DropDownList1.SelectedItem.ToString().
Hope this helpful,thanks!
Jun 08, 2011 01:05 AM|maygal|LINK
Both works, onclick of the button, the viewer changed to the report selected, let say report B (previously was report A), but when I click Export, it exports report A, but not the report in the viewer.