Solved

ReportViewer Refresh?

Posted on 2012-03-27
5
1,514 Views
Last Modified: 2012-04-07
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
Comment
Question by:adskarcox
  • 4
5 Comments
 

Author Comment

by:adskarcox
ID: 37788579
--
0
 
LVL 12

Expert Comment

by:CmdoProg2
ID: 37788898
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
 

Author Comment

by:adskarcox
ID: 37796360
CmdoProg2 - thank you for your post, but I am using C# (not visual basic).
0
 

Accepted Solution

by:
adskarcox earned 0 total points
ID: 37796362
I ended up removing the MultiView.
0
 

Author Closing Comment

by:adskarcox
ID: 37818652
No acceptable solutions were provided.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now