我想在UpdatePanel中更改DropDownList时调用JavaScript函数来显示/隐藏加载动画。
这是UpdatePanel中的DopDownList
<asp:UpdatePanel ID="UpdatePanel4" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddl_size" runat="server" OnSelectedIndexChanged="ddl_size_SelectedIndexChanged" AutoPostBack="true">/asp:DropDownList>
...
以下是我想要调用的JavaScript函数
function ShowLoadingAnimation() { ... }
function HideLoadingAnimation() { ... }
我是否使用触发器?我该如何使用它?提前谢谢。
答案 0 :(得分:1)
您可以使用PageRequestManager
的{{1}}和beginRequest
处理程序来显示/隐藏动画。实施详细信息位于Sys.WebForms.PageRequestManager beginRequest Event和Walkthrough: Animating ASP.NET UpdatePanel Controls MSDN页面上。
答案 1 :(得分:0)
将此代码放在aspx页面的JavaScript代码中:
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
function endRequestHandler() { yourJsFunction }