locked
Event Order (EWM) RRS feed

  • Question

  • User1288251396 posted

    I'm looking for a page event that I can use for error reporting.

    Specifically, I have a web user control that accumulates information that is to be reported to the user via a RegisterStartUpScript after all other processing is done.  The web user control is contained on a Master page, and the content page generates most of the informaion which the user control will handle.  Typically, this information reports the results of processing done in a grid.  But any server exception is also passed along to the user control.

    I'd like my user control to do it's reporting after all server processing is done, and I'd like to make that as automatic as possible.  I tried to identify a web user control event or a master page event that would reliably fire after all server processing was done, without success.  I ended up triggering the reporting from the content page's .PreRenderComplete event, but this requires a call from every content page.

    Does anybody have any suggestions?

    TIA

    Friday, August 1, 2008 1:48 PM

All replies

  • User481221548 posted

    Hi TIA

    I don`t understand exactly what you write.
    What you mean with "after all server processing"?

    I think Global.asax or better a HttpModule is your choise what i can determine.

    Monday, August 4, 2008 12:55 PM
  • User1288251396 posted

    Thank you, Peter, for helping. 

    I'm generating a page that has server controls on it, including DataGrid, SqlDataSource, DropDownList, etc., etc.  Each of these controls has events wherein one or more exceptions might occur.  My code-behind is handling these exceptions by accumulating information about them as they occur, and I want to report this information in an <asp:Label ...> and in a JavaScript pop-up created by a script registered using RegisterStartupScript.  So I want to wait until all possible exceptions have been thrown before I generate my reports.

    Secondly, the accumulation and reporting is done by a .ASCX user control, and I would like to have this control do its reporting in one of its own event handlers.  Unfortunately, there doesn't seem to be a .ASCX event that happens after all of the relevant events within the .ASPX page have occurred.  This issue is further complicated by the fact that the .ASCX is contained in a master page, and I want the .ASCX to report exceptions that might be generated by either the master or the content page.

    The best arrangement I've come up with to date is to add a .DisplayMyErrorReportsNow() method to the .ASCX, and call it from the content page's .PreRenderComplete event handler.  This seems to work, but (would you believe) I haven't tried it with every possible exception that might occur during the lifecycle of the master and content pages.

    So I'm wondering if anyone has any suggestions regarding the best event handler in which to trigger my reporting, preferably an event that the .ASCX could recognize.

    (I hope that's clearer.)

    P.S. "TIA" means "Thanks In Advance" (or aunt in Spanish).  My name is Ed.  But you can call me anything you want.  ;-)

    Monday, August 4, 2008 2:37 PM
  • User481221548 posted

    Hi Ed (sorry for calling wrong ;)

    The best Event would Application_Error be.
    A Control is not the right point to catch the Errors.

    I would make use of a HttpModule or simply the Global.asax, wireup the Error Event, catch the errors.
    Save the errros and then display it on the Way you like.

    On the other side you could wireup the Error Event of you Page.
    But Errors on the Application Scope would not be catched like so.

    Monday, August 4, 2008 3:19 PM
  • User1288251396 posted

    I'm catching errors using Try/Catch.  That's not the problem.  The problem is knowing when I can do my error reporting.

    Monday, August 4, 2008 5:16 PM
  • User481221548 posted

    Hi Ed

    I would seperate the catching of erros and summarize infos about, and displaying the infos.
    Because your in the wrong context (ApplicationContext) to do both in one.

    Monday, August 4, 2008 6:04 PM
  • User1288251396 posted

    I don't think I'm doing "both in one."  I have no idea what ApplicationContext is, and when I Google it, the results seem to indicate it has something to do with WinForms applications.  I am not doing a WinForms application; this is all web application server-side processing.

    I am simply looking for an event that triggers late enough in the lifecycle of a Web Form, its Master Page, and a Web User Control (on the Master Page) that it can use for reporting errors that happened during the main processing of the page's code-behind.  In other words, an event that doesn't trigger until all the databinding, etc., has completed.

    Monday, August 4, 2008 9:14 PM