update progress bar

Last post 08-02-2007 2:41 PM by lak. 9 replies.

Sort Posts:

  • update progress bar

    07-29-2007, 9:59 AM
    • Member
      5 point Member
    • lak
    • Member since 07-26-2007, 10:27 AM
    • Posts 31

    Hi,

     I have a search page and search results page.I want to include update progress bar in "search results page" that shows up on page loading and once page load is completed and the page results are shown to the user i want to hide this update progress bar.Is this possible with out button interaction from the user,If possible How can i do this pls help me with sample on how to do this

     

    Thanks 

     

    Filed under:
  • Re: update progress bar

    07-29-2007, 1:32 PM
    • Star
      13,595 point Star
    • gt1329a
    • Member since 06-23-2002, 8:53 PM
    • Atlanta
    • Posts 2,248
    • ASPInsiders
      TrustedFriends-MVPs
  • Re: update progress bar

    07-29-2007, 9:31 PM
    • Member
      5 point Member
    • lak
    • Member since 07-26-2007, 10:27 AM
    • Posts 31

    If i use the below code under <script> tags i am getting error on page loading

    Errors On the page is shown on the browser status bar 

       var prm = Sys.WebForms.PageRequestManager.getInstance();
      prm.add_initializeRequest(InitializeRequest);
      prm.add_endRequest(EndRequest);
      function InitializeRequest(sender, args)
      {
        $get('Container').className = 'Progress';
        $get(args._postBackElement.id).disabled = true;
      }
     
      function EndRequest(sender, args)
      {
         $get('Container').className = 'Normal';
        $get(sender._postBackSettings.sourceElement.id).disabled = false;
      }

  • Re: update progress bar

    07-29-2007, 9:55 PM
    • Star
      13,595 point Star
    • gt1329a
    • Member since 06-23-2002, 8:53 PM
    • Atlanta
    • Posts 2,248
    • ASPInsiders
      TrustedFriends-MVPs

    It needs to be below the page's ScriptManager to work exactly like that.  Alternatively (and probably better in general), you can change the PageRequestManager setup stuff to this:

    Sys.Application.add_load(AppLoad);

    function AppLoad()
    {
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);
    Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(InitializeRequest);
    }
    That'll delay referencing the PageRequestManager until it's available.
    Encosia - ASP.NET, jQuery, AJAX, and more.

    Latest article: Emulate ASP.NET validation groups with jQuery validation
  • Re: update progress bar

    07-29-2007, 11:19 PM
    • Member
      5 point Member
    • lak
    • Member since 07-26-2007, 10:27 AM
    • Posts 31

     I didnt quite get that, i have a master page and where script manager is available for whole application,I am adding PageRequestManager Script to the user control does it work. i feel
    this is wrong,do i need add it to the page where i am regestering the control still it doesnt work

    pls let me know

    Thanks 

     

     

     

  • Re: update progress bar

    07-29-2007, 11:51 PM

    You have to incluude the ScriptManager in Master Page itself.

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: update progress bar

    07-29-2007, 11:56 PM
    • Member
      5 point Member
    • lak
    • Member since 07-26-2007, 10:27 AM
    • Posts 31

     sorry its not the answer to my question ,or if i dont understand can u be clear

    Thanks 

  • Re: update progress bar

    08-01-2007, 11:11 PM
    Answer

    Hi lak,

    Based on my understanding of your question:You want to start Ayncpostback immediately after search results page loaded.

    If I have misunderstood ,please let me know.

    Based on my understanding,please try the following code to resolve your issue:

    <%@ Page Language="C#" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">
        protected void Button1_Click(object sender, EventArgs e)
        {
            System.Threading.Thread.Sleep(3000);
            TextBox1.Text = DateTime.Now.ToString();
        }
    </script>

    <script type="text/javascript">
    function delayLoad()
    {
    document.getElementById("<%= Button1.ClientID %>").click();
    document.getElementById("<%= UpdateProgress1.ClientID %>").style.display = "block";
    }
    </script>

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
    </head>
    <body onload="javascript: delayLoad()">
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    <div visible="true"><asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /></div>
                </ContentTemplate>
            </asp:UpdatePanel>
            <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
                <ProgressTemplate>
                    Waiting..............
                </ProgressTemplate>
            </asp:UpdateProgress>
        </div>
        </form>
    </body>
    </html>

    More informatin,see:Delaying Content Load using Timer and UpdatePanel & Controlling visibility of contents of collapsiblepanel & Start callback immediately after page loaded

    Please tell me the result of this code.

    Good luck.

    Sincerely,
    Jin-Yu Yin
    Microsoft Online Community Support
  • Re: update progress bar

    08-02-2007, 2:34 AM

    Thanks Jin-Yu Yin Smile

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: update progress bar

    08-02-2007, 2:41 PM
    • Member
      5 point Member
    • lak
    • Member since 07-26-2007, 10:27 AM
    • Posts 31

    Hi Jin-Yu Yin,

     I want to show update progress bar while page is loading and want to hide the update progress bar after page load is completed how can i do this, in the above code with the button click the async activates the progress bar.can i know how to show the progress bar while page is loading i mean without a button click or any other events

     

    Thanks 

     

Page 1 of 1 (10 items)