Last post Aug 04, 2008 09:14 PM by WombatEd
Aug 01, 2008 01:48 PM|WombatEd|LINK
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?
Aug 04, 2008 12:55 PM|Peter Bucher|LINK
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.
Aug 04, 2008 02:37 PM|WombatEd|LINK
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
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. ;-)
Aug 04, 2008 03:19 PM|Peter Bucher|LINK
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.
Aug 04, 2008 05:16 PM|WombatEd|LINK
I'm catching errors using Try/Catch. That's not the problem. The problem is knowing when I can do my error reporting.
Aug 04, 2008 06:04 PM|Peter Bucher|LINK
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.
Aug 04, 2008 09:14 PM|WombatEd|LINK
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
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.