jQuery的手风琴不会重新启动一个asp.Net后回传 [英] jquery accordion not re-initiating after an asp.Net postback

查看:172
本文介绍了jQuery的手风琴不会重新启动一个asp.Net后回传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我烧了一个jQuery的手风琴:

I'm firing up a jquery accordion with:

$(document).ready(function(){
   $('#accordion').accordion();
});

问题是这是一个.asp.NET应用程序,如果页面触发回发是破坏了手风琴。我怎么回发后重新启动手风琴?

Problem is this is an .asp.NET application and if the page fires a postback is destroys the accordion. How do I re-initiate the accordion upon postback?

对不起,我不是在asp.NET的专家,也对不起我不能给你一个链接的例子,这是因为它是一个受密码保护的应用程序。

Sorry I'm not an expert on asp.NET, and also sorry I can't give you a link to the example, this is because it's a password protected application.

感谢。

推荐答案

您需要的岗位回来的UpdatePanel的功能后重新initlaize手风琴:

You need to re-initlaize the accordion after the post back with the UpdatePanel functions as:

<script type="text/javascript"> 
$(document).ready(function(){
    var prm = Sys.WebForms.PageRequestManager.getInstance();    
        prm.add_initializeRequest(InitializeRequest);
        prm.add_endRequest(EndRequest);
   // on page ready first init of your accordion
   $('#accordion').accordion();
});


function InitializeRequest(sender, args) {      
}

function EndRequest(sender, args) {
     // after the UpdatePanel finish the render from ajax call
     //  and the DOM is ready, re-initilize the accordion
     $('#accordion').accordion();
}
</script>

相对:结果
<一href=\"http://stackoverflow.com/questions/3341623/asp-net-updatepanel-in-gridview-jquery-datepicker/3341741#3341741\">Asp.Net在UpdatePanel的GridView的jQuery的DatePicker的结果
<一href=\"http://stackoverflow.com/questions/2985937/asp-net-need-to-run-javascript-on-update-panel-load-completed/2987484#2987484\">ASP.Net :需要在更新面板负荷运行JavaScript完成结果
<一href=\"http://stackoverflow.com/questions/3257973/how-do-you-get-client-side-script-to-execute-on-an-asp-net-postback-from-an-up/3258167#3258167\">How做你的客户端脚本上的ASP.NET回发执行? (来自一个UpdatePanel)

这篇关于jQuery的手风琴不会重新启动一个asp.Net后回传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆