Solved

ReportViewer Refresh?

Posted on 2012-03-27
5
1,510 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

9 Experts available now in Live!

Get 1:1 Help Now