Creating onClick event for dynamically (programatically) created buttons

  • Thread starter Thread starter Hrvoje Vrbanc
  • Start date Start date
H

Hrvoje Vrbanc

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.Controls.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
 
I'm speaking about adding the event handler, of course.
I realized I didn't write what I really want clearly.

Hrvoje
 
Back
Top