C# 使用asp.net c在Reportviewer中设置文本框值#
我有一个包含文本框和tablix的reportviewer。 tablix使用数据源填充(该数据源使用存储的proc从查询字符串中获取数据,该proc包含2个参数)。 如何将查询字符串的值指定为reportviewer文本框的值。 比如: 此报表从查询字符串val1到查询字符串VAL2 标记:C# 使用asp.net c在Reportviewer中设置文本框值#,c#,asp.net,reportviewer,C#,Asp.net,Reportviewer,我有一个包含文本框和tablix的reportviewer。 tablix使用数据源填充(该数据源使用存储的proc从查询字符串中获取数据,该proc包含2个参数)。 如何将查询字符串的值指定为reportviewer文本框的值。 比如: 此报表从查询字符串val1到查询字符串VAL2 标记: <rsweb:ReportViewer ID="ReportViewer1" runat="server" CssClass="ReportAlignment" Font-Names="V
<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>
谢谢。如果您在文本框中保存带有所需值的报告,您可以通过报告定义中的xml来获取值,但是我不建议这样做。 您最好在报告的外面有一个文本框,然后将它交给查询以获取数据
除上述内容外,我几乎可以肯定,从用户指定的报告文本框中获取值是不可能的,除非保存报告,然后处理报告的定义并获取值,如果您不知道自己在做什么,这将是一件痛苦的事情。您的方法似乎是正确的,只需在报告中创建一个参数“ReportParameter1”,如果您还没有创建并将其绑定到文本框,它应该可以工作
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();
}