Because you haven't cancelled the event, when you click the button, it submits the form. Since it's inside the
UpdatePanel
, the page is updated without reloading.
You've attached the event handler to specific elements in the document. When the page is updated via an
UpdatePanel
, those elements are replaced with the content returned from the server.
The
$(document).ready(...)
event won't fire when the page is updated via an
UpdatePanel
, so your event handler doesn't get attached to the new buttons.
You could move the code that wires up the event handlers to the client-side
pageLoad
event, but that wouldn't be particularly efficient. Instead, you should attach the event handler at a higher level, and let the click events bubble up the tree from the button to the document element:
$(document).ready(function () {
$(document).on('click', '.thbut', function() {
manager = new ClickManager(this);
manager.check();
});
});
See the "Direct and delegated events" section in the jQuery documentation for more details:
.on() | jQuery API Documentation[
^]