//upnlControl is an UpdatePanel defined in the .aspx
ScriptManager.RegisterClientScriptBlock(upnlControl,
upnlControl.GetType(), upnlControl.ClientID,
"$(document).ready(someNamespace.init);", true);
inside the js file:
// namespace
var someNamespace = someNamespace ? someNamespace : {
/*
* handleSomeClickEvent
* handles some click event
* when something is clicked
* inside the update panel
*/
handleSomeClickEvent:function() {
alert('Wow! This runs every time the element is clicked!');
},
/*
* Init
* Initializer that will run
* on each page load.
*/
init: function() {
// setup event handlers
$('.someSelector').click(someNamespace.handleSomeClickEvent);
}
};
// kickoff someNamespace.init when DOM is ready.
$(document).ready(someNamespace.init);
No comments:
Post a Comment