locked
Passing Parameter to set Chart Y-Axis Label dynamically RRS feed

  • Question

  • User1622508631 posted

    Can someone help me set the Chart Member Label (shown below) programatically from an aspx.cs page? ...

    PicPaste: Capture-azbkpgWk.PNG>

    If I select it manually it shows other categories...

    PicPaste: Capture-4eIZxXYO.PNG

    These categories are what I want to change programatically with an aspx page.

    Tuesday, May 15, 2012 12:24 PM

All replies

  • User-8475372 posted

    From your aspx page, pass a parameter (hidden) which will be this Location. For that Location label, directly assign the report parameter value. 

    Please note that the parameter should be hidden.

    Way to pass the parameter to the report : 


     this.reportViewer.ServerReport.ReportPath = strReport;
                    RptParameters = new Microsoft.Reporting.WebForms.ReportParameter[1];
                    RptParameters[0] = new Microsoft.Reporting.WebForms.ReportParameter("                                                      <ParameterName>", "<ParameterValue>");               
                    this.reportViewer.ServerReport.SetParameters(RptParameters);     
                    reportViewer.ServerReport.Refresh();

    Wednesday, May 16, 2012 1:48 AM
  • User1622508631 posted

    Hi,

    The solution did not work.

    First of all its a local report.

    I might be able to better explain by showing screenshots of what I'm trying to do (Please click on screenshot to enlarge):

    Here you can see in red circles what I want to change dynamically, it is an rdlc file:

    Im using Choose() function to get value from ReportParameter1 to either choose Location or SubLocation like this:

    =Choose(Parameters!ReportParameter1.Value, Fields!Location.Value, Fields!SubLocation.Value)

    In report parameter I'm setting 2 values which are 1 and 2

    Default value of the parameter is set to 1

    At this point, without any call from aspx.cs codebehind, it should theoretically show fetch the value 1 as default value from the parameter...

    But when I run it, this happens

    Note that if I change =Choose(Parameters!ReportParameter1.Value, Fields!Location.Value, Fields!SubLocation.Value) to say =Choose(1, Fields!Location.Value, Fields!SubLocation.Value) then theoretically it should select Location.Value right? And it does...

    So whats going on? Obviously the Choose() function is correct. All I want is to pass value 1 or value 2 into the choose() function.

    Can anyone please help?

    Monday, May 21, 2012 8:12 AM
  • User1622508631 posted

    Anyone?

    Tuesday, May 22, 2012 5:55 AM