Handling dynamically created controls

G

Guest

I am dynamically generating a number of button controls based on the results returned from a search carried out on another machine. When one of these buttons is selected I want to be able to go through the same event handler for each button but I can't seem to get to happen unless I regenerate all my previously dynamically generated buttons every time the page is submitted.
Is this the only way to do this as the original search can take quite a while to carry out but it is the only way to get the information back in order to regenerate the buttons again (which will not be used again) and it might return quite a lot of results thus I don't think I want to be storing the search results in a session variable.
Basically all I need is for the selected button's values to be picked up without having to regenerate all my dynamically generated buttons again. Can anyone help?
 
J

John Saunders

PeteBr said:
I am dynamically generating a number of button controls based on the
results returned from a search carried out on another machine. When one of
these buttons is selected I want to be able to go through the same event
handler for each button but I can't seem to get to happen unless I
regenerate all my previously dynamically generated buttons every time the
page is submitted.

The way ASP.NET works, controls have to be regenerated on every request.
Remember that the page is destroyed after each request.
 

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

Staff online

Members online

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top