views:

889

answers:

2

Hello,

How can i use progress bar in web application c#, without ajax tools... When i click from one page to next page..the page load should be shown as in progress bar.. Can anyone help out, without ajax tools..

Thank you in advance

+1  A: 

I think you still need javascript but dont need to use the AJAX update panel.

  1. on your page add a div with an progress animated image
  2. set the div to hidden using CSS
  3. on your linkbutton/button or whatever, link up your onClick event as normal
  4. on the same linkbutton/button add an onClientClick attribute and call a javascript function to set the div style to visible

this will in effect display the progress meter until the page has actually posted back.

Wired up Button

 <asp:Button ID="btnProgress" runat="server" Text="show progress" OnClientClick="javascript:DisplayProgress()" OnClick="btnProgress_Click"
            CausesValidation="false" />

Progress Meter Div

    <div ID="pnlProgress" Class="modalBackground" style="visibility: hidden;">
        <div id="content" class="modalDialogClear" style="text-align: center; " > 
        <br />
        <br />
    looking up address, please wait...<br />
    <img src="/images/progress_bar.gif" />
    </div>

Javascript

  function DisplayProgress()
        {
            document.getElementById('pnlProgress').style.visibility = 'visible';
            window.setTimeout(HideProgressPanel, 20000);  //handles hiding the progress panel should the operation time out
        }

    function HideProgressPanel()
    {
    document.getElementById('pnlProgress').style.visibility = "hidden", 20000
    }
Mauro
+1  A: 

I did in this way, when page load, before loading complete I am show progress bar...

<body onload="javascript:HidePreloader();">

 <div id="preloader" style="width: 100%; text-align: center;">
                    <img src="../Images/loading.gif" alt="" style="display: block;" />
                </div>

<script language="javascript" type="text/javascript">
    function HidePreloader() {
        if (document.getElementById('preloader') != null) {
            document.getElementById('preloader').style.visibility = 'hidden';

        }
    }
</script>
Muhammad Akhtar
the question says "without ajax tools"
Mauro
plz check now...
Muhammad Akhtar