2013-02-09 142 views
1

我有一個DatasetReportviewer結合,我dataset有兩臺Paramters,在報告響亮的數據將顯示正常投放問題是,當我通過paremeters在新的價值觀reportviewer和我點擊搜索Buttonreportviewer之前的數據確實有變化。意味着較新的搜索數據將不會顯示!不考慮更新數據

這裏是我的代碼:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
      mysession() 
      ReportViewer1.ProcessingMode = ProcessingMode.Local 
      Dim rep As LocalReport = ReportViewer1.LocalReport 
      rep.ReportPath = "Leaving Report.rdlc" 
      Dim ds1 As DataSet = GetData() 

      Dim EMpReplt As New ReportDataSource() 
      EMpReplt.Name = "ProlDataSet_Lrepoert" 
      EMpReplt.Value = ds1.Tables("EMPData") 
      rep.DataSources.Add(EMpReplt) 
End sub 

Private Function GetSalesData() 
     Dim ds As New DataSet 
     Dim sql As String = "select * from laeve where Status='" & DropDownList1.SelectedValue & "' and Agent='" & Session("Agence") & "'" 
      Dim command As New SqlCommand(sql,con) 
      Dim mysqlAdapter As New SqlDataAdapter(command) 
      mysqlAdapter.Fill(ds, "EMPData") 
      mysqlAdapter.Dispose() 
      command.Dispose() 
     End Using 
     Return ds 
    End Function 
End Sub 


Protected Sub Search_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click 
    ReportViewer1.LocalReport.Refresh() 
End Sub 

回答

0

嘗試放置.IsPostBackUsing the WebForms ReportViewer Control

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
      mysession() 
    If Not Page.IsPostBack Then 
      ReportViewer1.ProcessingMode = ProcessingMode.Local 
      Dim rep As LocalReport = ReportViewer1.LocalReport 
      rep.ReportPath = "Leaving Report.rdlc" 
      Dim ds1 As DataSet = GetData() 

      Dim EMpReplt As New ReportDataSource() 
      EMpReplt.Name = "ProlDataSet_Lrepoert" 
      EMpReplt.Value = ds1.Tables("EMPData") 
      rep.DataSources.Add(EMpReplt) 
    End if 
End sub 
+0

我都準備好使用我大聲頁這樣ReportViewer1.LocalReport.Refresh()。 – user1453058 2013-02-09 07:11:55

+0

所以如何工作。 – spajce 2013-02-09 07:18:57

+0

Reportviewer不吃肉任何變化, – user1453058 2013-02-09 07:24:30