caoimhincryan
asked on
Call Control from master page using OnError method
I am using VS 2005. I have a web page designed using Ajax and ASP.NET , VB.Net is code behind.
In my master page I have a panel that visible property is set to false. In this panel i have a message I want to display when an error occurs in my application.
E.G. List.aspx page - To catch the error i have a method
Protected Overrides Sub OnError(ByVal e As System.EventArgs)
MyBase.OnError(e)
' 'do stuff here
UpdatePanel1.Visible = False
CType(Me.Form.Parent.FindC ontrol("Er rorHandler Panel"), Panel).Visible = True ' This is the panel on my master page
Response.Write(Server.GetL astError() .Message)
Server.ClearError()
End Sub
To test this in my application I have added Throw New ApplicationException("Blah h") on my page load event.
All thats displayed is "Blahh" . Would anyone know how to display my panel from my master page?
However, if I remove Throw New ApplicationException("Blah h") and add CType(Me.Form.Parent.FindC ontrol("Er rorHandler Panel"), Panel).Visible = True into the onLoad event, it will display fine.
It just seems that the problem is getting the panel to display from the onError method.
Any ideas?
In my master page I have a panel that visible property is set to false. In this panel i have a message I want to display when an error occurs in my application.
E.G. List.aspx page - To catch the error i have a method
Protected Overrides Sub OnError(ByVal e As System.EventArgs)
MyBase.OnError(e)
' 'do stuff here
UpdatePanel1.Visible = False
CType(Me.Form.Parent.FindC
Response.Write(Server.GetL
Server.ClearError()
End Sub
To test this in my application I have added Throw New ApplicationException("Blah
All thats displayed is "Blahh" . Would anyone know how to display my panel from my master page?
However, if I remove Throw New ApplicationException("Blah
It just seems that the problem is getting the panel to display from the onError method.
Any ideas?
ASKER
Hi Ventaur,
Thanks for the quick response.
However all that is displaying is a blank screen.
Any ideas?
Thanks for the quick response.
However all that is displaying is a blank screen.
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I agree with you ventaur. I will leave the question open another while to see if anyone has other ideas for the question.
Understood. Good luck!
Are your users going to debug and fix your application? They why display the error message to them? I personally email errors to the programmers, and redirect the user to a basic page saying "whoops".
ASKER
I thought maybe with Ajax that it might be possible instead of an error page. Error page is the way to go.
If you'd like to show the message inside your panel, try this instead. You could even put this in the master page instead.
Open in new window