L
Landley
Hi All,
I am trying to raise a custom event from a user control. I have supplied my
code below. It calls OnSave method that attempts to raise the save event,
but it never gets to the handler in the default.aspx.vb file.
[registration.ascx]
Public Event Save(ByVal sender As Object, ByVal e As
RegistrationFormEventArgs)
Protected Overridable Sub OnSave(ByVal sender As Object, ByVal e As
RegistrationFormEventArgs)
RaiseEvent Save(sender, e)
End Sub
[default.aspx]
<%@ Register TagPrefix="cs" TagName="RegistratonForm"
src="./controls/RegistrationFormTable.ascx" %>
...
<cs:RegistratonForm ID="RegistratonForm" Runat="server"
Visible="False"></cs:RegistratonForm>
...
[registration.ascx.vb]
Dim e As RegistrationFormEventArgs
Try
e = New RegistrationFormEventArgs([My Parameters Go Here])
OnSave(Me, e)
If e.Saved Then
ClearForm()
Else
MessageLabel.Text = "Save Failed. " & e.ErrorMessage
End If
Catch ex As Exception
RaiseException(ex)
Finally
e = Nothing
End Try
[default.aspx.vb]
Private Sub RegistrationForm_Save(ByVal sender As Object, ByVal e As
RegistrationFormEventArgs) Handles RegistrationForm.Save
Try
..
Catch ex As Exception
RaiseException(ex)
e.Saved = False
e.ErrorMessage = ex.Message
End Try
End Sub
Any ideas?
Landers
I am trying to raise a custom event from a user control. I have supplied my
code below. It calls OnSave method that attempts to raise the save event,
but it never gets to the handler in the default.aspx.vb file.
[registration.ascx]
Public Event Save(ByVal sender As Object, ByVal e As
RegistrationFormEventArgs)
Protected Overridable Sub OnSave(ByVal sender As Object, ByVal e As
RegistrationFormEventArgs)
RaiseEvent Save(sender, e)
End Sub
[default.aspx]
<%@ Register TagPrefix="cs" TagName="RegistratonForm"
src="./controls/RegistrationFormTable.ascx" %>
...
<cs:RegistratonForm ID="RegistratonForm" Runat="server"
Visible="False"></cs:RegistratonForm>
...
[registration.ascx.vb]
Dim e As RegistrationFormEventArgs
Try
e = New RegistrationFormEventArgs([My Parameters Go Here])
OnSave(Me, e)
If e.Saved Then
ClearForm()
Else
MessageLabel.Text = "Save Failed. " & e.ErrorMessage
End If
Catch ex As Exception
RaiseException(ex)
Finally
e = Nothing
End Try
[default.aspx.vb]
Private Sub RegistrationForm_Save(ByVal sender As Object, ByVal e As
RegistrationFormEventArgs) Handles RegistrationForm.Save
Try
..
Catch ex As Exception
RaiseException(ex)
e.Saved = False
e.ErrorMessage = ex.Message
End Try
End Sub
Any ideas?
Landers