ASP.NET的UpdatePanel JavaScript回调 [英] ASP.NET UpdatePanel Javascript Callback
问题描述
我碰到这个问题,最近来了,以为是真的很有帮助。我的问题是,在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屋!