all groups > asp.net webcontrols > february 2008 >
You're in the

asp.net webcontrols

group:

Handling Events For Dynamically Created Buttons


Re: Handling Events For Dynamically Created Buttons Masudur
2/24/2008 10:50:00 PM
asp.net webcontrols: [quoted text, click to view]

Hi...

Once you have created the controls... constract a viewstate variable
or session variable to that you can know that dynamically created
links are exists...
After each post back "on Init" first determine wheither dynamically
added controls exists or not... if exists do create the dynamically
added links again...
asp.net will automatically map the event and fire it...
but make sure the control ids remain same...


Masudur
www.munna.shatkotha.com
Handling Events For Dynamically Created Buttons Nathan Sokalski
2/25/2008 12:38:45 AM
I have LinkButtons that are dynamically created in one of the PostBack
events. They must be created in the PostBack event because one of the
variables required to determine which ones to create comes from the event
arguments. Because the LinkButtons are not created in the Init event, they
will not exist when I click them to perform a postback. How do I handle the
events for these LinkButtons? I appreciate any help you can give. Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

Re: Handling Events For Dynamically Created Buttons Nathan Sokalski
2/25/2008 10:01:21 PM
That would be fine if the number of dynamically created LinkButtons had a
maximum, but it doesn't. Therefore, I would not know how many to create in
the Init event. Also, is there any site you can give me that has a good
example of how to do this? Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

[quoted text, click to view]

AddThis Social Bookmark Button