[CLOSED] How to show loading mask on the page while an Ajax function is processing?

  1. #1

    [CLOSED] How to show loading mask on the page while an Ajax function is processing?



    I have a few long running processes that need to be executed sequentially in code and would like a loading mask to show on the page while they are processing. After each task is done, I would like to update a label on the page and then start the next task which then will show a loading mask while it processes, and so on until each task has been completed. Does anyone have a quick example or method for me? Thanks in advance...

    
    <%@ Page Language="vb" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <script runat="server">    
            Protected Overloads Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
                If Not Page.IsPostBack Then
                    Label1.Html &amp;= "<br />Page Load: " &amp; Now.ToString
                    GetTimeStamp1()
                End If
                
            End Sub
        
            <AjaxMethod()> _
            Public Sub GetTimeStamp1()        
                Label1.Html &amp;= "<br />1: " &amp; Now.ToString
                'now I want to update the label and show a loading mask while this task executes
                Threading.Thread.Sleep(1000)
                GetTimeStamp2()
            End Sub
    
    
            <AjaxMethod()> _
            Public Sub GetTimeStamp2()            
                Label1.Html &amp;= "<br />1: " &amp; Now.ToString
                'now I want to update the label and show a loading mask while this task executes
                Threading.Thread.Sleep(1000)
                GetTimeStamp3()
            End Sub
    
    
            <AjaxMethod()> _
            Public Sub GetTimeStamp3()
                Label1.Html &amp;= "<br />3: " &amp; Now.ToString
                'now I want to update the label and show a loading mask while this task executes
                Threading.Thread.Sleep(1000)
            End Sub
        </script>
    
    
        <script type="text/javascript">
     
        </script>
    
    
    </head>
    <body>
    <form id="form1" runat="server">
        <ext:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Debug">
        </ext:ScriptManager>
        <ext:Label ID="Label1" runat="server"></ext:Label>
    </form>
    </body>
    </html>
  2. #2

    RE: [CLOSED] How to show loading mask on the page while an Ajax function is processing?

    Hi,

    Today we added LoadMask support for AjaxMethod (you need update)*
    Please see the following post:
    http://forums.ext.net/showthread.php?postid=7736.aspx



  3. #3

    RE: [CLOSED] How to show loading mask on the page while an Ajax function is processing?



    Great, how fortuitous :)

    A last quick question, how can I call the next function from the current one without using a button click? Is that even possible or do I need to do some kind of button click from the code?

  4. #4

    RE: [CLOSED] How to show loading mask on the page while an Ajax function is processing?



    I fired a button click on a hidden button to do it...

    Public Sub AjaxMethod1()
      ScriptManager1.AddScript("alert('done: " &amp; Now.ToString &amp; "');")
      ScriptManager1.AddScript("Button2.fireEvent('click', this);")
      System.Threading.Thread.Sleep(1000)
    End Sub
    <ext:Button ID="Button2" runat="server" Text="AjaxMethod2" Hidden="true">
      <Listeners>
        <Click Handler="Coolite.AjaxMethods.AjaxMethod2({eventMask:{showMask:true, msg:'Loading...'}})" />
      </Listeners>
    </ext:Button>
    Please mark as [CLOSED].

Similar Threads

  1. [ Initial Page Start Loading (Mask Load) ]
    By iDevSEO in forum 1.x Help
    Replies: 2
    Last Post: Dec 29, 2011, 1:15 PM
  2. [CLOSED] Changing loading mask text during ajax event
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 22, 2010, 10:20 AM
  3. Replies: 1
    Last Post: Nov 01, 2009, 6:08 AM
  4. Page Loading Mask
    By sachin.munot in forum 1.x Help
    Replies: 1
    Last Post: Oct 13, 2009, 9:27 AM
  5. [CLOSED] Show mask on listener function
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 15
    Last Post: Apr 01, 2009, 8:28 AM

Posting Permissions