Tutorial :onclick event not working after ASP.net AJAX save



Question:

I have an gridview that I am adding onclick events to a checkbox column via:

   cb.InputAttributes.Add("onclick", "checkClick()");  

everything works fine, but when the user clicks the save button on the form, (which is within the updatepanel), suddenly the onclick event of the checkboxes stops firing!

Is this a problem with the ASP.net AJAX?

The wierd thing is that I am seeing the onclick event on the source, it just doesn't fire.

Help!


Solution:1

The source will show you the state of the document when first received from the server, not the current state of the DOM. What is likely happening is the update panel content is being replaced by new HTML content. The elements to which the original click events were bound are no longer in the dom.

The onclick events will need to re-bound to wire-up to the new elements that have arrived.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »