我有一个包含文本框和tablix 的reportviewer。tablix 使用数据源填充(它使用存储的过程获取数据,其中包含来自查询字符串的 2 个参数)。如何将查询字符串的值指定为我的 reportviewer 文本框的值。类似于:此 ReportfFrom 查询字符串 val1 以查询字符串 val 2。
标记:
<rsweb:ReportViewer ID="ReportViewer1" runat="server"
CssClass="ReportAlignment" Font-Names="Verdana" Font-Size="8pt"
InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana"
WaitMessageFont-Size="14pt" Width="550px">
<LocalReport ReportPath="TempEmpWageSummaryReport.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="LoadWageSummary" Name="DataSet1" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:SqlDataSource ID="LoadWageSummary" runat="server"
ConnectionString="<%$ ConnectionStrings:stockerConnectionString %>"
SelectCommand="procTempEmployeeWageSummaryReport"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:QueryStringParameter Name="startDate" QueryStringField="start"
Type="String" />
<asp:QueryStringParameter Name="endDate" QueryStringField="end" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
背后的代码
protected void Page_Load(object sender, EventArgs e)
{
string start = Server.UrlDecode(Request.QueryString["start"]);
string end = Server.UrlDecode(Request.QueryString["end"]);
//this.ReportViewer1.LocalReport.ReportEmbeddedResource = "TempEmpWageSummaryReport.rdlc";
string param0 = "GROUPED TEMPORARY EMPLOYEE WAGE SUMMARY REPORT FROM " + start + "to " + end;
ReportParameter rp = new ReportParameter("ReportParameter1", param0);
this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
this.ReportViewer1.LocalReport.Refresh();
//BindReport();
}
谢谢。