Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9217723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:41:47+00:00 2026-06-18T02:41:47+00:00

I’m showing a remote report in a ReportViewer control. The report loads with a

  • 0

I’m showing a remote report in a ReportViewer control. The report loads with a few default parameters. So far everything is ok.

But when i change a few input values and hit View Report then the report simply shows the data with the default values. The parameters that i changed in the input fields are also reset.

All the code i have is this:

apsx

<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"
    Font-Size="8pt" Height="642px" ProcessingMode="Remote" Width="100%">
    <ServerReport ReportPath="http://server.com/Product/Dashboards/test.rdl" 
        ReportServerUrl="http://server.com/ReportServer" />
</rsweb:ReportViewer>

The CodeBehind is basically empty. All it has now is an empty Page_Load.

That is all my code.

But it feels like a ViewState issue? But I am not sure where to look.

Anyone any idea why the parameters are resrt when I press on the View Report button?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:41:49+00:00Added an answer on June 18, 2026 at 2:41 am

    I solved this by setting the parameters myself in the Code Behind. So when the report is submitted, i then get all the entered data, put that in a ReportParameters collection.

    But unfortunately this wasn’t as easy and straight forward as one would think. At first you might think this is stored in: YourReport.ServerReport.GetParameters(). But that is not the case!

    To get the submitted values from your report you can use the following code:

    Get report submitted parameters

    public ReportParameter[] GetCurrentParameters(Microsoft.Reporting.WebForms.ReportViewer viewer)
    {
        Control params1Area = FindParametersArea(viewer);
        List<ReportParameter> params1 = new List<ReportParameter>();
        FindParameters(params1Area, params1);
        return params1.ToArray();
    }
    
    private Control FindParametersArea(Microsoft.Reporting.WebForms.ReportViewer viewer)
    {
        foreach (Control child in viewer.Controls)
        {
            if (child.GetType().Name == "ParametersArea")
                return child;
        }
    
    
        return null;
    }
    
    private void FindParameters(Control parent, List<ReportParameter> params1)
    {
        Type _ParameterControlType = System.Reflection.Assembly.GetAssembly(typeof(Microsoft.Reporting.WebForms.ReportViewer)).GetType("Microsoft.Reporting.WebForms.BaseParameterInputControl");
    
        ReportParameter param;
        Microsoft.Reporting.WebForms.ReportParameterInfo paramInfo;
        String[] paramValues;
        foreach (Control child in parent.Controls)
        {
            if (_ParameterControlType.IsAssignableFrom(child.GetType()))
            {
                paramInfo = (Microsoft.Reporting.WebForms.ReportParameterInfo)GetPropertyValue(child, "ReportParameter");
                if (paramInfo == null)
                    continue;
    
    
                paramValues = (string[])GetPropertyValue(child, "CurrentValue");
                if (paramValues != null && paramValues.Length > 0)
                {
                    param = new ReportParameter();
                    param.Name = paramInfo.Name;
                    param.Values.AddRange(paramValues);
                    params1.Add(param);
                }
            }
            FindParameters(child, params1);
        }
    }
    
    public object GetPropertyValue(object target, string propertyName)
    {
        return target.GetType().GetProperty(propertyName, System.Reflection.BindingFlags.IgnoreCase | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public).GetValue(target, null);
    }
    

    Source: http://forums.asp.net/t/1057747.aspx/1 (Also Visual Basic examples)

    You invoke those methods by just using the following line of code. Preferably in a if(IsPostBack) scope within your Page_Load for example.

    ReportParameter[] reportParameters = GetCurrentParameters(ReportViewer1);
    

    It is then possible to overwrite the submitted values if you also have custom textfields. You can easily do that like so:

    reportParameters[4] = new ReportParameter("year", "2013", true);
    

    You obviously have to know what param is stored at index 4. But you could also make an easy lookup function that searches for the reportParameter with a specific name. So in my case year.

    Simple parameter lookup

    protected void ChangeParameterValue(String name, String newValue, ref ReportParameter[] parameters)
    {
        foreach (ReportParameter param in parameters)
        {
            if (String.Equals(param.Name, name))
            {
                param.Values[0] = newValue;
                break;
            }
        }
    }
    

    You use that like so:

    ChangeParameterValue("year", "2013", ref reportParameters);
    

    This way you don’t have to worry about at what index a certain parameter is placed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to clean up various Word 'smart' characters in user input, including but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I want to construct a data frame in an Rcpp function, but when I
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.