Results 1 to 2 of 2

Thread: Event not fire

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Europe, Lithuania
    Posts
    309

    Event not fire

    Hey,

    I created button dynamicaly and added handler to it, but for some reason, event do not fire, then I press it.

    What can be wrong?

    VB Code:
    1. Protected WithEvents LeftPane As System.Web.UI.HtmlControls.HtmlTableCell
    2.  
    3.  Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    4.             If Page.IsPostBack = False Then
    5.  
    6.  Dim myButton As New Button
    7.                     myButton.Text = "Save"
    8.                     myButton.ID = "SubmitButton"
    9.                     AddHandler myButton.Click, AddressOf Me.Submitas
    10.  
    11. LeftPane.Controls.Add(myButton)
    12.  
    13.  
    14.             End If
    15.  
    16. End Sub
    17.  
    18.         Private Sub Submitas(ByVal sender As System.Object, ByVal e As System.EventArgs)
    19.  
    20.             Response.Write("Click")
    21.         End Sub

  2. #2
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    After PostBack is the button still on the page? And I think if you declare a null button outside of the Load event it may help, but in truth that shouldn't mater.
    Magiaus

    If I helped give me some points.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width