i have a reportviewer containing a a textbox and tablix. The tablix is populated using a datasource(which gets data using a stored proc with 2 parameters from a query string). How do i specify the value of the query strings as the value of my reportviewer textbox. something like: This ReportfFrom query String val1 to query String val 2.
我有一个包含文本框和tablix的reportviewer。 Tablix使用数据源填充(数据源使用存储过程获取数据,其中包含来自查询字符串的2个参数)。如何将查询字符串的值指定为reportviewer文本框的值。类似于:This ReportfFrom查询字符串val1到查询字符串val 2。
markup:
标记:
<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>
The code behind
背后的代码
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();
}
Thanks.
谢谢。
1 个解决方案
#1
1
If you save the report with the value desire in the textbox you can process through the xml in the report's definition to grab the value, however I wouldn't recommend this. You're better off just having a textbox outside the report for this and just give that to the Query to fetch the data.
如果在文本框中保存带有值desired的报表,则可以通过报表定义中的xml处理以获取值,但我不建议这样做。你最好只在报告之外设置一个文本框,然后将其提供给Query以获取数据。
Other than the above, I'm almost certain that grabbing the value from the textbox in the report that the user has specified isn't possible, unless the report is saved and then you process through the report's definition and grab the value which is a pain if you don't know what you're doing.
除了上述内容之外,我几乎可以肯定,除非保存报告,然后通过报告的定义处理并获取值为如果你不知道自己在做什么,那就太痛苦了。
#1
1
If you save the report with the value desire in the textbox you can process through the xml in the report's definition to grab the value, however I wouldn't recommend this. You're better off just having a textbox outside the report for this and just give that to the Query to fetch the data.
如果在文本框中保存带有值desired的报表,则可以通过报表定义中的xml处理以获取值,但我不建议这样做。你最好只在报告之外设置一个文本框,然后将其提供给Query以获取数据。
Other than the above, I'm almost certain that grabbing the value from the textbox in the report that the user has specified isn't possible, unless the report is saved and then you process through the report's definition and grab the value which is a pain if you don't know what you're doing.
除了上述内容之外,我几乎可以肯定,除非保存报告,然后通过报告的定义处理并获取值为如果你不知道自己在做什么,那就太痛苦了。