Passing parameter from reportviewer to another reportviewer RRS feed

  • Question

  • User-601355136 posted


    I am having really tough time trying to figure this issue out.  Here is my scenario of what I wanted to.

    1. I have various reports i have developed in SSRS.
    2. I have embedded one report in default.aspx using Master page and working fine.
    3. I have embedded another report in page2.aspx
    4. Trying to click textbox in the report from default.aspx and pass parameter to report in page2.aspx page.  
    5. So when clicking a link it will lead me to page2.aspx with parameter from default.aspx.
    I am very new to .asp and reportviewer,  Been googling but no luck.  Any help is appreciated!

    Tuesday, December 20, 2011 1:04 PM

All replies

  • User-8475372 posted

    Hi Jazz,

    If your requriment is regarding passing of parameter from one report to another report you can use the sub reports of SSRS where you click on an item in the report and it Drilldowns to the subreport. This can be acheived by :

    - Right click on the item for which you want to create a drilldown and select properties.

    - Click on Action Tab of the properties and you can mention the subreport name there with the required parameter to be sent.

    If your requirment is about passing the parameters to the reportviewer from C# code, it can be done as follows : 

    Microsoft.Reporting.WebForms.ReportParameter[] RptParameters;
                reportViewer.ServerReport.ReportServerUrl = new System.Uri(ConfigurationManager.AppSettings["ReportServerURL"]);
                reportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
                reportViewer.ToolBarItemBorderColor = System.Drawing.Color.PowderBlue;
                reportViewer.ToolBarItemBorderStyle = BorderStyle.Double;
                string strUserName = ConfigurationManager.AppSettings["UserName"].ToString();
                string strPassword = ConfigurationManager.AppSettings["Password"].ToString();
                string strDomain = ConfigurationManager.AppSettings["Domain"].ToString();
                reportViewer.ServerReport.ReportServerCredentials = new ReportCredentials(strUserName, strPassword, strDomain);
                string strReport = string.Empty;
                strReport = ConfigurationManager.AppSettings["ReportsFolder"] + Request.QueryString["ReportName"].ToString();
    Below snippet shows on how to pass parameters to the report  :
                    this.reportViewer.ServerReport.ReportPath = strReport;
                    RptParameters = new Microsoft.Reporting.WebForms.ReportParameter[1];
                    RptParameters[0] = new Microsoft.Reporting.WebForms.ReportParameter("                                                      <ParameterName>", "<ParameterValue>");               
    You can pass any number of parameters to the report. Just make sure that the <ParameterName> matches with the parameter name in the report. 
    Tuesday, December 20, 2011 11:22 PM
  • User-601355136 posted

    thanks for the reply Srikanth.

    I would need to use 2nd solution to achieve what I want to do.  Is there another way rather than do it in C#?  what i did was create new web project and when I double click on page2.aspx it brings up page2.aspx.vb (Page_Load) is this the place where I would need to put the code? 



    Wednesday, December 21, 2011 8:04 AM
  • User-8475372 posted

    Yes please put the code in page_load. 

    Convert your code here.

    Thursday, December 22, 2011 4:50 AM
  • User-1902167853 posted

    Try assigning an action within the report, and passing it to a URL and using the javascript window.open method to send it to your new page.

    Something like this:

    ="javascript:void(window.open('http://www.yoursite.com/page2.aspx&pParameter1=" & Fields!parameter.Value & "','_self','width=465px,height=760px,toolbar=1,menubar=1,location=1,status=1,scrollbars=1,resizable=1'))"
    Wednesday, January 4, 2012 12:52 PM