Creating onClick event for dynamically (programatically) created buttons

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hrvoje Vrbanc

    #1

    Creating onClick event for dynamically (programatically) created buttons

    Hello all!

    My question is the following: I add buttons (server controls)
    programatically into a table cell. Example:

    Dim btObnovi As Button = New Button()
    celija25.Contro ls.Add(btObnovi )

    The number of rows in the table depends on number of records in a database.
    Therefore, the number of buttons is variable.
    Every button, naturally, gets its own ClientID (_ctl0, ctl1, etc.). But how
    I determine which button was clicked and how do I set up OnClick event for
    particular buttons?
    I would like to take a text from a text box in the row where the button was
    clicked and then to manipulate it. But first, I need to know how to write a
    onClick sub.

    Thank you very much in advance.

    Hrvoje


  • vrba

    #2
    Re: Creating onClick event for dynamically (programaticall y) created buttons

    I'm speaking about adding the event handler, of course.
    I realized I didn't write what I really want clearly.

    Hrvoje

    "Hrvoje Vrbanc" <hrvojev@recro. hr> wrote in message
    news:e7z#MYvRDH A.212@TK2MSFTNG P10.phx.gbl...[color=blue]
    > Hello all!
    >
    > My question is the following: I add buttons (server controls)
    > programatically into a table cell. Example:
    >
    > Dim btObnovi As Button = New Button()
    > celija25.Contro ls.Add(btObnovi )
    >
    > The number of rows in the table depends on number of records in a[/color]
    database.[color=blue]
    > Therefore, the number of buttons is variable.
    > Every button, naturally, gets its own ClientID (_ctl0, ctl1, etc.). But[/color]
    how[color=blue]
    > I determine which button was clicked and how do I set up OnClick event for
    > particular buttons?
    > I would like to take a text from a text box in the row where the button[/color]
    was[color=blue]
    > clicked and then to manipulate it. But first, I need to know how to write[/color]
    a[color=blue]
    > onClick sub.
    >
    > Thank you very much in advance.
    >
    > Hrvoje
    >
    >[/color]


    Comment

    Working...