0

I would like to call JavaScript functions to show/hide a loading animation when a DropDownList is changed in an UpdatePanel.

Here is the DopDownList in an UpdatePanel

<asp:UpdatePanel ID="UpdatePanel4" runat="server">
  <ContentTemplate>
    <asp:DropDownList ID="ddl_size" runat="server" OnSelectedIndexChanged="ddl_size_SelectedIndexChanged" AutoPostBack="true">/asp:DropDownList>
    ...

Here are the JavaScript functions I want to call

function ShowLoadingAnimation() { ... }
function HideLoadingAnimation() { ... }

Do I use triggers? How do I use it? Thanks in advance.

2 Answers 2

1

You can use PageRequestManager's beginRequest and endRequest handlers to show/hide animation. The implementation details are on Sys.WebForms.PageRequestManager beginRequest Event and Walkthrough: Animating ASP.NET UpdatePanel Controls MSDN pages.

Sign up to request clarification or add additional context in comments.

Comments

0

Put this code in the JavaScript tag in your aspx page:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler); 
function endRequestHandler() { yourJsFunction }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.