一个UpdatePanel的部分回发后执行JavaScript? [英] Execute javascript after a partial postback of an updatepanel?

查看:172
本文介绍了一个UpdatePanel的部分回发后执行JavaScript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页,添加树文件脚本吧。

I have a page that add tree file script to it .

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/init.js"></script>
<script type="text/javascript" src="js/easing.js"></script>

我有一个DropDownList一个UpdatePanel的。当运行SelectedIndexChanged事件(一个UpdatePanel的局部回传),不执行JavaScript的。

I have a updatepanel with a dropdownlist. When run SelectedIndexChanged event (partial postback of an updatepanel), don't execute javascript .

推荐答案

使用

function pageLoad(sender, args) {

  InitialiseSettings();
}

function InitialiseSettings(){
    // replace your DOM Loaded settings here. 
    // If you already have document.ready event, 
    // just take the function part and replace here. 
    // Not with document.ready 
    $(element).slideUp(1000, method, callback});

    $(element).slideUp({
                   duration: 1000, 
                   easing: method, 
                   complete: callback});
}

add_endRequest 事件处理程序尝试:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(InitialiseSettings)

更新

Update

做的更好,一旦移动的所有code从的document.ready到InitialiseSettings功能,并把它传递给 <一个href=\"http://msdn.microsoft.com/en-us/library/bb397523%28v=vs.100%29.aspx\"><$c$c>pageLoaded事件

Better do it once move the all the code from document.ready to InitialiseSettings function and pass it to pageLoaded event

Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(InitialiseSettings)

code示例

Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(InitialiseSettings)

这篇关于一个UpdatePanel的部分回发后执行JavaScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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