RegisterDocument - When delegate function is triggered?

Posted by: gefferson on 10 September 2017, 11:49 am EST

  • Posted 10 September 2017, 11:49 am EST

    Hi Ashish!

    I'm trying follow your article in http://our.componentone.com/2011/12/22/change-recordsource-of-wijmo-reportviewer/

    Your sample works very fine...
    But, my database tables are very large and are occurs a small delay in make a document and load this document in reportViewer.

    This would not a problem if I could make a document behind the scenes (showing a ajax loader counter, for example) and after redirect to aspx page with reportviewer control.

    But, in my tests, I does not can do this... The 'makeDoc' delegate function only is triggered after the reportviewer control is rendered in aspx page.

    Please, tell me what I'm doing wrong... My sample follow attached.

    Thanks a lot for your help, Ashish... This issue is very important for I end my tests and migrate my solution to reportviewer.
  • Replied 10 September 2017, 11:49 am EST

    Oops! Appears that winrar files not allow...

    Follow my sample in zip format.
    2012/09/WebApplication9.zip
  • Replied 10 September 2017, 11:49 am EST

    Hello Gefferson,

    I aplogise for the delay in response. I would like to inform you that makeDoc() mehtod is called only after setting the "ReportName" property of C1ReportViewer. Therefore it is required to have C1Reportviewer control to be on the same page as the makeDoc() method.

    There is also one more requirement that "ReportName" property must be a new name every time the report is bound to the control, this is because reports are cached on the server. To flush the cache, we need to change something in the FileName/ReportName pair of properties for the new report to be rendered. We must change the 'C1ReportViewer.ReportName' so that it is unique for each of the data files – NOT the name of the report specify in C1Report.Load.

    Here is the modified code from your sample that you can use:

     protected void btRegisterDocument_Click(object sender, EventArgs e)
    {
    if (C1.Web.Wijmo.Controls.C1ReportViewer.C1ReportViewer.HasCachedDocument("Common Tasks", "Common Tasks")){
    C1.Web.Wijmo.Controls.C1ReportViewer.C1ReportViewer.UnRegisterDocument("Common Tasks");
    }

    C1.Web.Wijmo.Controls.C1ReportViewer.C1ReportViewer.RegisterDocument("Common Tasks", makeDoc);
    //must set fileName and ReportName property after RegisterDocument()
    C1ReportViewer1.FileName = "Common Tasks";
    //ReportName will be unique everytime by appending Current DateTime
    C1ReportViewer1.ReportName = "Common Tasks"+DateTime.Now;
    //makeDoc called after ReportName is set.
    }


    Hope this helps..!!
    Regards
    Nidhi
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels