Creating onClick event for dynamically (programatically) created buttons

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
 
V

vrba

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

Hrvoje
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top