我已经为mouseenter和mouseleave绑定了jquery事件,还有jquery draggable。这些div放置在一个更新面板中,当点击按钮向数据库发送信息并更新更新面板时,然而当面板更新时,jquery事件不再起作用。你有任何想法为什么会出现这种情况吗?
我已经为mouseenter和mouseleave绑定了jquery事件,还有jquery draggable。这些div放置在一个更新面板中,当点击按钮向数据库发送信息并更新更新面板时,然而当面板更新时,jquery事件不再起作用。你有任何想法为什么会出现这种情况吗?
//This script handles ajax postbacks, by registering the js to run at the end of *AJAX* requests
Page.ClientScript.RegisterStartupScript(typeof(Page), "ajaxTrigger", "Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);", true);
Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "EndRequest", "function EndRequestHandler(sender, args){AsyncDone();}", true);
尝试使用
function pageLoad(sender, args)
{
// JQuery code goes here
}
$(document).ready(function() {
// JQuery code goes here
});
/**
* .NET Event Handlers
* When new code is added on to the client by way of
* .NET PostBacks, CSS is typically ignored. This method
* can be used to add CSS to new elements as they are added
* asynchronously. It calls a script at the end of every
* partial post back request.
*
* @example - Core.NETEventHandlers.AsyncPostBack.Init();
*/
var NETEventHandlers: {
/**
* Async Post Back Handler
* calls a script at the end of every partial post back request
*/
AsyncPostBack: {
EndRequest: {
Add: function() {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(NETEventHandlers.AsyncPostBack.EndRequest.Handler);
} // EO Add
, Handler: function(sender, args) {
// Handlers here.
alert('Hello World');
} // EO Handler
} // EO endRequest
, Init: function() {
Sys.Application.add_init(NETEventHandlers.AsyncPostBack.EndRequest.Add);
}
} // EO AsyncPostBack
} // EO dotNETEventHandlers