John's Technical Blog
Thursday, 1 October 2009
ASPNET: ReportViewer Control Example
<--form name="frmReportFrame" method="post" runat="server">
<--rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt"
ProcessingMode="Remote" ShowParameterPrompts="false" Width="100%" Height="100%"
ShowBackButton="false" ShowFindControls="false" ShowPageNavigationControls="true"
ShowToolBar="true" BackColor="#efefef" InternalBorderColor="#efefef">
<--ServerReport />
<--/rsweb:ReportViewer>
<--/form>
in frmReportFrame.aspx.cs:
if (Request.QueryString.Count > 0)
{
string ReportPath = "";
if (Request.QueryString["WS"] == "old")
{
ReportPath = ConfigurationSettings.AppSettings["KSTReportpath"].ToString();
}
else
{
ReportPath = ConfigurationSettings.AppSettings["KSTReportChartPath"].ToString();
}
string path = ConfigurationSettings.AppSettings["KSTReportURL"].ToString();
ReportViewer1.ServerReport.ReportServerUrl = new Uri(path);
ReportViewer1.ServerReport.ReportPath = ReportPath;
ReportParameter[] Rparms = new ReportParameter[5];
//WinUserName=wrkhyd05raghu&ViewID=-2&WorksheetID=4&WorkBookCode=kst&PermissionSetId=4&rc:Parameters=false";
Rparms[0] = new ReportParameter("WinUserName", Request.QueryString["WinUserName"].ToString());
Rparms[1] = new ReportParameter("ViewID", Request.QueryString["ViewID"].ToString());
Rparms[2] = new ReportParameter("WorksheetID", Request.QueryString["WorksheetID"].ToString());
Rparms[3] = new ReportParameter("WorkBookCode", Request.QueryString["WorkBookCode"].ToString());
Rparms[4] = new ReportParameter("PermissionSetId", Request.QueryString["PermissionSetId"].ToString());
ReportViewer1.ServerReport.SetParameters(Rparms);
ReportViewer1.ServerReport.Refresh();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment