Greg
Greg

Reputation: 7383

How do I perform an action after an UpdatePanel updates?

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).

Upvotes: 3

Views: 539

Answers (3)

Michiel Overeem
Michiel Overeem

Reputation: 3982

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.

Upvotes: 0

Atanas Korchev
Atanas Korchev

Reputation: 30661

You can use the endRequest event of the PageRequestManager class.

Upvotes: 4

Mark Cidade
Mark Cidade

Reputation: 99957

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.

Upvotes: 1

Related Questions