views:

293

answers:

3

When I have a regular textbox in a UpdatePanel (not an ASP.NET control) with some JavaScript events on it, after the UpdatePanel updates my events are gone. Is there a way to re-attach my events after the update? (Preferably without putting my events inline).

+1  A: 

You can have a setInterval() loop on document load that would search for the element in the update panel and if it didn't have the events, it can re-attach them.

Mark Cidade
+3  A: 

You can use the endRequest event of the PageRequestManager class.

korchev
A: 

The events are gone because your textbox is a new element in the DOM (after the UpdatePanel refresh). As said by korchev, use the endRequest event to re-attach the eventhandlers.

Michiel Overeem