SQL报告服务在报告查看器的顶部有一个小小的搜索框。使用时,它会查找搜索文本,导航到包含页面并突出显示页面上的文本。我的问题是,如何在报告加载时执行此操作。Sql报告服务 - 查找报告中的项目 - 正在加载
目前我在我的页面中嵌入了一个报表查看器。有没有一种方法可以找到?我正在使用SQL 2008 express和Dot Net 2
例如,我将序列号1234发送到报告,以便在打开时它就像用户搜索文本并在报告中为他们找到它一样。
埃德给了我对url部分的答案。 http://server/Reportserver?/SampleReports/Product Catalog&rc:FindString=mystring
但我仍然无法弄清楚reportviewer。
下面是一些页面代码:
using Microsoft.Reporting.WebForms;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Int32 iID = Convert.ToInt32(Request.QueryString["ID"]);
String reportsPath = ConfigurationManager.AppSettings["ReportsPath"];
String sReportName = "ReportInvoice";
reportViewer1.Reset();
reportViewer1.ProcessingMode = ProcessingMode.Remote;
reportViewer1.ShowParameterPrompts = false;
reportViewer1.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportViewerUrl"]);
reportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials();//http://localhost/reportserver
reportViewer1.AsyncRendering = false;
ReportParameter[] reportParams = new ReportParameter[1];
reportViewer1.ServerReport.ReportPath = reportsPath + sReportName;
reportParams[0] = new ReportParameter("invoiceID", iID.ToString());
reportViewer1.ServerReport.Refresh();
}
}
在此先感谢。
这是一个非常有趣的解决方案。它会在很多情况下工作。我的特别报告是一个25页的报告。该项目可能在第15页。如果我也可以跳转到页面(比如find),那将是完美的。 – Praesagus 2009-08-27 17:13:55
我以为ReportViewer控件会有一个用于提供FindString的成员(您可以在Refresh命令后立即调用Method,或者可以事先设置Property)。 – 2009-08-28 00:09:49