B
Brad
I added an Error event to a web usercontrol (ascx), but when an error is
raised in the control it does not get called...only the Application_Error
even in the global.asax gets called. The same thing in an aspx works
correctly. Does the Error event not really work with a user control or is
there something I am misunderstanding?
Thanks
Brad
Code Example:
==============================
Public Class WebUserControl1
Inherits System.Web.UI.UserControl
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'bad code which causes an error
Dim x As DataTable
Dim y As DataRow = x.Rows(0)
End Sub
Private Sub Page_Error(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Error
'do something here
'add a debug breakpoint to test error raised.
End Sub
End Class
raised in the control it does not get called...only the Application_Error
even in the global.asax gets called. The same thing in an aspx works
correctly. Does the Error event not really work with a user control or is
there something I am misunderstanding?
Thanks
Brad
Code Example:
==============================
Public Class WebUserControl1
Inherits System.Web.UI.UserControl
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'bad code which causes an error
Dim x As DataTable
Dim y As DataRow = x.Rows(0)
End Sub
Private Sub Page_Error(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Error
'do something here
'add a debug breakpoint to test error raised.
End Sub
End Class