Fer*_*Fer 8 javascript vb.net asp.net ajax updatepanel
我有一个aspx页面,由3个用户控件(ascx)组成.我有一个更新面板包装3个用户控件,如下所示:
<asp:UpdatePanel ID="UpdatePanelWrapper" runat="server">
<ContentTemplate>
<uc1:UserControl1 ID="UserControl1" runat="server" />
<uc2:UserControl2 ID="UserControl2" runat="server"/>
<uc2:UserControl3 ID="UserControl3" runat="server"/>
</ContentTemplate>
</asp:UpdatePanel>
Run Code Online (Sandbox Code Playgroud)
我通过单独显示每个用户控件,因此当显示"UserControl1"时,隐藏其他2个用户控件.
在"UserControl1"里面我有一些asp控件和一些javascript函数.我的问题是,当刷新"UpdatePanelWrapper"时,永远不会调用这些javascript函数.
我已经尝试过这个解决方案http://blog.dreamlabsolutions.com/post/2009/02/24/jQuery-document-ready-and-ASP-NET-Ajax-asynchronous-postback.aspx,通过添加javascript调用内部"UserControl1"虽然不起作用.只有当我在aspx页面中添加javascript调用但不在"UserControl1"内部时,我才能使用它.
任何帮助将不胜感激,谢谢.
Muh*_*tar 11
这是你怎么做的....
<script type="text/javascript">
Sys.Application.add_init(appl_init);
function appl_init() {
var pgRegMgr = Sys.WebForms.PageRequestManager.getInstance();
pgRegMgr.add_endRequest(EndHandler);
}
function EndHandler() {
// This will be called whenever your updatepanel update
// It will be trigger after the update updatepanel
//add your javascript here
}
</script>
Run Code Online (Sandbox Code Playgroud)