ASP.NET的UpdatePanel JavaScript回调 [英] ASP.NET UpdatePanel Javascript Callback

查看:83
本文介绍了ASP.NET的UpdatePanel JavaScript回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我碰到这个问题,最近来了,以为是真的很有帮助。我的问题是,在ASP.NET AJAX的你会如何调用一段JavaScript代码的一个UpdatePanel加载后?

我需要重新初始化jQuery的日期选择器,专家组已经加载之后。


解决方案

 <脚本类型=文/ JavaScript的>变种PRM = Sys.WebForms.PageRequestManager.getInstance();
prm.add_pageLoaded(panelLoaded);功能panelLoaded(发件人,参数){    //你的code在这里}< / SCRIPT>

从本质上讲这是创建PageRequestManager的实例负责处理所有在UpdatePanel加载。然后绑在panelLoaded功能的pageLoaded事件。

我也发现这个文章,其中介绍了这是更多的细节:<一href=\"http://msdn.microsoft.com/en-us/magazine/cc163413.aspx\">http://msdn.microsoft.com/en-us/magazine/cc163413.aspx

I came across this issue recently and thought it was really helpful. My question was, how would you call a piece of javascript after an updatepanel loads via AJAX in ASP.NET?

I needed to reinitialize a jQuery datepicker after the panel had loaded.

解决方案

<script type="text/javascript">

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_pageLoaded(panelLoaded);

function panelLoaded(sender, args){

    // Your code here

}

</script>

Essentially this is creating an instance of the PageRequestManager which handles all the UpdatePanel loading. Then ties the panelLoaded function to the pageLoaded event.

I also found this article which explains this is much more detail: http://msdn.microsoft.com/en-us/magazine/cc163413.aspx

这篇关于ASP.NET的UpdatePanel JavaScript回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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