views:

577

answers:

1

Hi,

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!

+4  A: 

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.

AnthonyWJones
Thanks Anthony, I rebound the events on the save action and everything worked fine!
Mark Kadlec