none
why ReportViewer dose not bind with right rdlc in postback? RRS feed

  • Question

  • Hi.  I have a reportviewer in my .net 2.0 web applicaiton and i am using localreport of this reportviewer and bind objectdatasource. I want this reportviewer bind to differrent rdlc based on what user choose on the dropdown list. The reportviewer rendered fine except that when user change their selection in the dropdownlist, the reportviewer did not pickup the right rdlc even the reportviewer path is set correctly.   This is only happening during page postback.

    Some of my code:

    Dim mypaycheck As New PayCheck( )

    ReportViewerCheck.Visible = True

     ReportViewerCheck.LocalReport.DataSources.Clear()

     If flag= "D" Then  ReportViewerCheck.LocalReport.ReportPath = "Reports\repot1.rdlc"

    Else ReportViewerCheck.LocalReport.ReportPath = "Reports\report2.rdlc"    -/// flag is driven by user selection

    End If

    ReportViewerCheck.LocalReport.DataSources.Add(New ReportDataSource("Header", mypaycheck.Headers)) 

    ReportViewerCheck.LocalReport.Refresh()

     

    for example, the user first see report1 and they change selection in dropdownlist to see report 2, the reportviewer still bind to report1

    even though the data is bind correctly and in debug mode, I can see the report path is set correctly to tdlc report2. That  looks very strange to me. If someone has some idea, please help me with this. Thanks

    Thursday, May 3, 2007 8:59 PM

All replies