Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   Dynamic Control capture button click. (http://www.velocityreviews.com/forums/t775519-dynamic-control-capture-button-click.html)

sakieboy 02-28-2005 10:53 PM

Dynamic Control capture button click.
 
I have dynamically added controls using a Placeholder to a form. This form
is data driven thus I never know how many records will be retrieve. My form
looks like this
txtKey0=1111, txtBox0, txtDate0, btnEdit0
txtKey1=2323, txtBox1, txtDate1, btnEdit1
txtKey2=4343, txtBox2, txtDate2, btnEdit2
etc.

When I select a button I need to find out what my txtkey value is so that I
can pass it to a Querystring and display another page. Of course, currently
I only have one btnEdit_Click event which seems pretty lost. How do I get my
key values depending upon the button that I select. Or would I be better off
putting this in a datagrid control?

Wilco Bauwer 02-28-2005 11:05 PM

Re: Dynamic Control capture button click.
 
A datagrid, repeater or datalist may be a good choice. If you do not
use that, then you can set the button's CommandName and CommandArgument
properties. Instead of handling their click event, you should then
handle the Command event. All controls' Command event can have the same
event handler. Inside that event handler you can then extract the
information from the CommandName/CommandArgument properties to do your
thing.

In case you have problems related to dynamically loaded controls, you
may also want to take a look at
http://wilcoding.xs4all.nl/Wilco/View.aspx?NewsID=147.

----
- Wilco Bauwer
Blog & Custom Controls @ http://wilcoding.xs4all.nl



All times are GMT. The time now is 08:06 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.