Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ajax "loading" icon with UpdatePanel postbacks

I have a form that is being dynamically built depending on user selection using Ajax (built in .NET Ajax with UpdatePanel).

how can I insert a "standard" ajax loading icon (maybe have it attached to the mouse pointer) while the postback is happening then remove it when the post back is finished?

I do have the AjaxToolKit installed if that helps.

like image 345
Kyle Avatar asked May 11 '10 18:05

Kyle


People also ask

Can we use nested UpdatePanel in Ajax?

To nest UpdatePanel controlsIn the AJAX Extensions tab of the toolbox, double-click the ScriptManager control to add it to the page. In the toolbox, double-click the UpdatePanel control to add an UpdatePanel control to the page.

What is UpdatePanel in Ajax in asp net?

UpdatePanel controls are a central part of AJAX functionality in ASP.NET. They are used with the ScriptManager control to enable partial-page rendering. Partial-page rendering reduces the need for synchronous postbacks and complete page updates when only part of the page has to be updated.

What is UpdateMode conditional in UpdatePanel?

If the UpdateMode property is set to Conditional, and one of the following conditions occurs: You call the Update method of the UpdatePanel control explicitly. The postback is caused by a control defined as a trigger by using the Triggers property of the UpdatePanel control.


2 Answers

use updateprogress of tool kit :hope this will help you

<asp:updatepanel id="ResultsUpdatePanel" runat="server">    
<contenttemplate>

<div style="text-align:center;">
    <asp:updateprogress id="UpdateProgress1" runat="server" associatedupdatepanelid="ResultsUpdatePanel" dynamiclayout="true">
                        <progresstemplate>

                           <img src="support/images/loading.gif">

                        </progresstemplate>
                    </asp:updateprogress>

                    </div>

 //your control code
</contenttemplate>
</asp:updatepanel>
like image 186
Pranay Rana Avatar answered Sep 21 '22 09:09

Pranay Rana


Use following code...

 <html xmlns="http://www.w3.org/1999/xhtml">
 <head runat="server">
     <title></title>
 </head>
 <body>
    <form id="form1" runat="server">
     <div>
         <asp:ScriptManager ID="ScriptManager1" runat="server">
          </asp:ScriptManager>
    <asp:UpdateProgress ID="updProgress"
    AssociatedUpdatePanelID="UpdatePanel1"
    runat="server">
        <ProgressTemplate>            
        <img alt="progress" src="images/progress.gif"/>
           Processing...            
        </ProgressTemplate>
    </asp:UpdateProgress>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Label ID="lblText" runat="server" Text=""></asp:Label>
            <br />
            <asp:Button ID="btnInvoke" runat="server" Text="Click" 
                onclick="btnInvoke_Click" />
        </ContentTemplate>
    </asp:UpdatePanel>         
      </div>
   </form>
  </body>
</html>


protected void btnInvoke_Click(object sender, EventArgs e)
{
    System.Threading.Thread.Sleep(3000);
    lblText.Text = "Processing completed";
}
like image 24
ankit rajput Avatar answered Sep 21 '22 09:09

ankit rajput