Sql Reporting services - find an item in a report - when loading

SQL Reporting Services has a small search box at the top of the report viewer. When used, it finds the search text, goes to the content of the page and selects the text on the page. My question is: how can I do this when the report loads.

Currently, a report is embedded on my page. Is there any way that will find? I am using SQL Express 2008 and Dot Net 2

For example, I send serial number 1234 to a report so that when it opens, it acts similar to the way a user looked for text and found it in a report.


Ed gave me an answer to the url part. http://server/Reportserver?/SampleReports/Product Catalog&rc:FindString=mystringbut I still can’t understand what Reportviewer is.


Here are some of the page code:

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();
    }
}

Thanks in advance.

+3
4

. MSDN ( SQL 2005, , , 2008 .

+2

MSDN - , , :

-, :

    TextBox txt;
    txt = (TextBox) this.ReportViewer1.Controls[1].Controls[4].Controls[0];        
    txt.Text = "test";

ReportViewer PreRender. 1 - , β„–4 - , . (4) , / . . , .

, , , ....

, .

javascript:

<script type="text/javascript">
    function OnFirstLoad() {
        if (!isPostBack)
            document.getElementById('ReportViewer1').ClientController.ActionHandler('Search', document.getElementById('ReportViewer1_ctl01_ctl04_ctl00').value);
    }
</script>

.aspx "find" , . , ctl01 ctl04 ctl00 , . , . (ctl04) - , .

onload javascript:

<body onload="OnFirstLoad();">

, . :

If (!IsPostBack)
    ClientScript.RegisterClientScriptBlock(GetType(), "IsPostBack", "var isPostBack = false;", true);
else
    ClientScript.RegisterClientScriptBlock(GetType(), "IsPostBack", "var isPostBack = true;", true);

, javascript. false, , .

, , . javascript .

, , , . .

, Windows .:)

!

+2

, RenderingComplete, Find, - :

public Report()
{
    InitializeComponent();


    rpViewer.RenderingComplete += new RenderingCompleteEventHandler(rpViewer_RenderingComplete);

}

void rpViewer_RenderingComplete(object sender, RenderingCompleteEventArgs e)
{
    int x = rpViewer.Find("0", 1);
}

EDIT:

, -, WinForms, , Javascript, klabranche.

, javascript html , :

private void SearchReport(ReportViewer rv, string SearchText)
{
    TextBox txt = (TextBox)rv.Controls[1].Controls[4].Controls[0];
    txt.Text = SearchText;
    this.Body.Attributes.Add("onload", "javascript:document.getElementById('" + rv.ClientID + 
        "').ClientController.ActionHandler('Search', '" + SearchText + "');");
}

, . , , , . , body html:

<body id="Body" runat="server">
+1

, , - :

=iif(me.value = Parameters!Highlight.value, "Yellow", "White")

, , Highlight.;)

Rob

0

Source: https://habr.com/ru/post/1714816/


All Articles