There is an edit button on the page upon landing in an updatepanel. User clicks edit button, the event that fires removes this button from the container and adds a save button (in the updatepanel). This function also attaches an event to the new button.
New button shows up on the page but clicking on it does not fire the event. Obviously event does not register. There is probably a trick to make this happen in the updatepanel but I could not figure it out. Does anybody know the answer?
Thanks in advance…
When you add controls dynamically, you must regenerate them on every postback, other way the events won’t be fired.
You must regenerate the controls on the page_init event.
I will do it like this:
i) write a “generateControl” function to generate the control.
ii) call this function when you want to generate it and set a flag (a public variable to true)
iii) on page_init check if the flag is true and call the “generateControl” function if it is.