Event question

Discussion in 'ASP .Net' started by shapper, Nov 10, 2006.

  1. shapper

    shapper Guest

    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
     
    shapper, Nov 10, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Purvi T
    Replies:
    0
    Views:
    925
    Purvi T
    Oct 19, 2004
  2. Dave Wurtz

    Event On Form From Control Event

    Dave Wurtz, Dec 9, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    375
    Kevin Spencer
    Dec 9, 2003
  3. =?Utf-8?B?QWxpcmV6YSBaaWFp?=

    PreRender Event occurs immediatley after Load event

    =?Utf-8?B?QWxpcmV6YSBaaWFp?=, Feb 9, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,154
    Hans Kesting
    Feb 9, 2004
  4. jorge
    Replies:
    2
    Views:
    1,339
    jorge
    May 26, 2004
  5. Lars Netzel
    Replies:
    3
    Views:
    460
    Greg Burns
    Jul 22, 2004
Loading...

Share This Page