[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1576
  • Last Modified:

ReportViewer Refresh?

I've got a ReportViewer control setup in a MultiView which has 2 Views.  The first View has questions for the user with dropdowns.  The second View contains the ReportViewer.  My goal is to setup the ReportViewer to display report data based on what the user selects in the dropdowns.

When I hard-code the query values into the ReportViewer and set the MultiView to load the 2nd View, it works fine.  When I set the MultiView to load View 1, however, by the time I get to the second View, the ReportViewer is not visible.

My best guess is that I need to fire a Reload method, or something like that, for the ReportViewer.  I researched this, however, and none of the items I tried seemed to work (e.g. .Refresh(), .Render() etc.)

Environment: C#.NET 4.0, Webforms
0
adskarcox
Asked:
adskarcox
  • 4
1 Solution
 
adskarcoxAuthor Commented:
--
0
 
CmdoProg2Commented:
The refresh method of the reportviewer does load the report.  Did you load the parameters prior to the refresh?  Here is a snippet of a remote server reportviewer in a multiview...

  Protected Sub btnFind_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFind.Click
          MultiView1.ActiveViewIndex = 1
          BuildReport()
  End Sub

  Private Sub BuildReport()
    'Get Report Server
    Dim urlReportServer As Uri = clsCommon.GetReportServer()

    With rvContributor
      .ServerReport.ReportServerUrl = urlReportServer
      .ServerReport.SetParameters(BuildParameters())
      .ServerReport.Refresh()
      .ShowPromptAreaButton = False
    End With

  End Sub
  Private Function BuildParameters() As System.Collections.Generic.List(Of ReportParameter)
    Dim paramList As New Generic.List(Of ReportParameter)
    paramList.Add(New ReportParameter("CountyID", ddlCounty.SelectedValue))
    paramList.Add(New ReportParameter("CountyInNotes", chkLookInNotes.Checked))
    Return paramList
  End Function

Open in new window

0
 
adskarcoxAuthor Commented:
CmdoProg2 - thank you for your post, but I am using C# (not visual basic).
0
 
adskarcoxAuthor Commented:
I ended up removing the MultiView.
0
 
adskarcoxAuthor Commented:
No acceptable solutions were provided.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now