I have a 2012 asp.net web form application, and one of its asp.net web form page (named "ReportHolder.aspx") contains asp.net ReportViewer control whose Id on markup page is ReportViewer1. The ReportViewer control on ReportHolder.aspx page is used to get and show remote 2012 SQL Server Report Service rdl reports. Those rdl reports are created with parameter input fields that are populated from stored procedures.
I am looking for a way of how to pass a hidden parameter (named "WebLoginUserId") from report viewer control to reports in the code behind of "ReportHolder.aspx" on the
first time loading of the "ReportHolder.aspx" page rather than using the "
SubmittingParameterValues" event of report viewer that users
must press the "View Report" button to pass such a hidden parameter to SSRS reports.
Currently, to pass such a hidden parameter from report viewer to remote rdl reports, I am using the "SubmittingParameterValues" event of the report viewer (see below). The problem with that event handler is users must press the "View Report" on reports so the hidden paramter "WebLoginUserId" value is passed.
My question: I would like to know if there is some way I can pass that hidden parameter to reports on the
first time loading of the "ReportHolder.aspx" page
rather than using the "
SubmittingParameterValues" event of report viewer. Please help.
The "SubmittingParameterValues" event handler:
protected void ReportViewer1_SubmittingParameterValues(object sender, ReportParametersEventArgs e)
{
if (e != null)
{
e.Parameters.Add(new ReportParameter("WebLoginUserId", someWebLoginUserVariable));
}
}
And the Page_Load event handler of "ReportHolder.aspx" who contains the report viewer control:
protected void Page_Load(object sender, EventArgs e)
{
ReportViewer1.ServerReport.ReportPath = MyReportPathVariable;
ReportViewer1.ServerReport.ReportServerUrl = new Uri(MyReportServerUrlVariable);
}