Event / handler

Discussion in 'ASP .Net Web Controls' started by Guest, Mar 10, 2005.

  1. Guest

    Guest Guest

    Hi
    Here is what I would like to do
    - create a web form page with a button control

    on the server, or on an inherited assembly
    - define the onClick event
    - add the onClick event handler to the button Control

    How can I do this, please?!

    TIA
    --
    Guest, Mar 10, 2005
    #1
    1. Advertising

  2. On the server-side, the event is Click.


    Public CmdDomain As Button
    Private Sub Page_Load _
    (ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load
    Dim intCounter As Integer
    Dim es As System.EventArgs
    For intCounter = 0 To 5
    CmdDomain = New Button
    CmdDomain.Text = "Button" & intCounter.ToString
    CmdDomain.CommandName = "Commandname" & intCounter.ToString
    CmdDomain.CommandArgument = "Domain" & intCounter.ToString
    AddHandler CmdDomain.Click, AddressOf CmdDomainClick
    DomainPlace.Controls.Add(CmdDomain)
    Next
    End Sub
    Sub CmdDomainClick(ByVal s As Object, ByVal e As EventArgs)
    Dim btnS As Button
    btnS = s
    Response.Write(btnS.Text)
    End Sub


    <dl> wrote in message news:...
    > Hi
    > Here is what I would like to do
    > - create a web form page with a button control
    >
    > on the server, or on an inherited assembly
    > - define the onClick event
    > - add the onClick event handler to the button Control
    >
    > How can I do this, please?!
    >
    > TIA
    > --
    >
    >
    >
    Ken Cox [Microsoft MVP], Mar 11, 2005
    #2
    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. sonic
    Replies:
    1
    Views:
    535
    John Saunders
    Jan 7, 2005
  2. Replies:
    1
    Views:
    695
    Damien
    Feb 22, 2007
  3. RC

    How to recall add event from an Event handler??

    RC, Jan 6, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    260
    John Saunders
    Jan 6, 2005
  4. Adi
    Replies:
    2
    Views:
    192
  5. Replies:
    0
    Views:
    143
Loading...

Share This Page