As @Artiom notes, this problem is because on update the UpdatePanel overwrites the existing markup with the markup generated on the postback, which obliterates any event handlers you had on HTML elements in the UpdatePanel.
There are a couple of ways to fix this, which I discuss in my article Rebinding Client-Side Events After a Partial Page Postback. The easiest approach (IMO) is to use jQuery's live
function. From my article:
If you are using jQuery, as I did in these examples, there's an even easier approach - the live()
function. The live()
function defines an event handler for one or more HTML elements now or in the future. What that means is that you can say things like, "Hey, jQuery, I want you to affix this event handler to the click event of any <a>
element on the page, whether it exists now or at some future point." Consequently, if an <a>
element is dynamically added to the page at a later time, jQuery will automatically wire up its click event to the specified event handler.
See the article for more information, as well as an example.