ReportViewer Control 以 Action Jump 到子 Report 後,透過 ServerReport.ReportPath 給另一張 Report 時,需先呼叫 Reset

若未呼叫 Reset,會發生 Operation is not valid due to the current state of the object 錯誤,參考如下:

http://social.msdn.microsoft.com/forums/en-US/vsreportcontrols/thread/701ad973-4b12-49d6-9566-d5e981835024/

自行實作的範例:http://cid-bf14192bd27975cb.skydrive.live.com/self.aspx/Source/SQL%202008/myReportViewerWeb.zip

ReportViewer1.Reset()

— ReportServerCredentials 自行實作Microsoft.Reporting.WebForms.IReportServerCredentials 介面的類別,以換身分
ReportViewer1.ServerReport.ReportServerCredentials = New ReportServerCredentials("a", "a", "") 
ReportViewer1.ServerReport.ReportPath = "/Report Project1/Parameter"

Dim prs(1) As Microsoft.Reporting.WebForms.ReportParameter
prs(0) = New Microsoft.Reporting.WebForms.ReportParameter("Country", Split(TextBox1.Text, ","))
prs(1) = New Microsoft.Reporting.WebForms.ReportParameter("City", Split(TextBox2.Text, ","))
ReportViewer1.ServerReport.SetParameters(prs)
ReportViewer1.ServerReport.Refresh()

這透過程式 Call Reset 沒問題,但若透過瀏覽器再 back 會舊報表,再執行 Action 還是會錯亂

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s

%d 位部落客按了讚: