Event question

S

shapper

Hello,

I have a custom control where I have a button.
I need to raise the event FormSubmited after all the code, in
Button_Click, is finished.

The problem is when I check FormSubmited in my page nothing happens:

Private Sub Form_FormSubmited(ByVal sender As Object, ByVal e As
EventArgs) Handles Form.FormSubmited
Response.Write("For Was Submited")
End Sub

My custom control code is as follows:
...
Public Class Contact
Inherits WebControl

Private Sub bSubmit_Init(ByVal sender As Object, ByVal e As
System.EventArgs)
.....
End Sub

Private Sub bSubmit_Click(ByVal sender As Object, ByVal e As
System.EventArgs)

' SOME CODE

' Raise the OnFormSubmited event
RaiseEvent FormSubmited(Me, EventArgs.Empty)

End Sub

Public Event FormSubmited As EventHandler
Protected Overridable Sub OnFormSubmited(ByVal e As EventArgs)
RaiseEvent FormSubmited(Me, e)
End Sub

Protected Overrides Sub CreateChildControls()

AddHandler bSubmit.Init, AddressOf bSubmit_Init
AddHandler bSubmit.Click, AddressOf bSubmit_Click
MyBase.Controls.Add(bSubmit)

End Sub

End Class

Could someone tell me what am I doing wrong here?

Thanks,
Miguel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top