Call Control from master page using OnError method
Posted on 2007-11-16
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)
' 'do stuff here
UpdatePanel1.Visible = False
CType(Me.Form.Parent.FindControl("ErrorHandlerPanel"), Panel).Visible = True ' This is the panel on my master page
To test this in my application I have added Throw New ApplicationException("Blahh") 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("Blahh") and add CType(Me.Form.Parent.FindControl("ErrorHandlerPanel"), 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.