Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Creating onClick event for dynamically (programatically) created buttons

Reply
Thread Tools

Creating onClick event for dynamically (programatically) created buttons

 
 
Hrvoje Vrbanc
Guest
Posts: n/a
 
      07-10-2003
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


 
Reply With Quote
 
 
 
 
vrba
Guest
Posts: n/a
 
      07-10-2003
I'm speaking about adding the event handler, of course.
I realized I didn't write what I really want clearly.

Hrvoje

"Hrvoje Vrbanc" <(E-Mail Removed)> wrote in message
news:e7z#(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
Handling Onclick Event from dynamically created linkbuttons (1.1) RSH ASP .Net 1 04-23-2007 02:43 PM
asp.net dynamically created button not firing onClick event rsaffy@nuvox.com ASP .Net 7 07-20-2006 09:02 PM
Managing ViewState of a dynamically created Custom Composite Server Control -(where the original is also dynamically created) dickster ASP .Net Building Controls 0 12-08-2005 09:32 AM
Accessing OnClick event for dynamically created controls. Jim Mitchell ASP .Net Web Controls 3 08-13-2003 02:54 AM



Advertisments