2

I have a button click event which does a lengthy function and takes time. So i want to display a progress bar. Can you let me know how can I do it.

I am very new to .NEt .. any help appreciated

Thanks in Advance, Amritha

Cheng Chen
  • 42,509
  • 16
  • 113
  • 174
Manasa
  • 183
  • 1
  • 2
  • 9
  • 2
    WinForm/WPF/Silverlight/WebForm/ASP.NET MVC? – Cheng Chen Feb 15 '11 at 09:17
  • I Would require something much more basic like using an update progress bar, I dont know the way to use it – Manasa Feb 15 '11 at 09:20
  • @Amritha, what Danny is asking if it is an ASP.NET app or windows form app (or something else)? – VinayC Feb 15 '11 at 09:22
  • 1
    @Amritha: for anything involving a UI, the way to do it will differ a lot between the various UI frameworks, so without knowing what UI environment you are targeting, it's more or less impossible to answer your question. – Fredrik Mörk Feb 15 '11 at 09:22
  • I am using VS 2010 and building an ASP.net Web app. So i am looking for displaying a progress bar on click of a button. Thank you – Manasa Feb 15 '11 at 09:24

1 Answers1

0

I think this example is basic enough:

<form id="form1" runat="server">
   <asp:ScriptManager ID="sm" runat="server" />
   <asp:UpdateProgress runat="server" id="PageUpdateProgress">
         <ProgressTemplate>
             Loading...
         </ProgressTemplate>
   </asp:UpdateProgress>
   <asp:UpdatePanel runat="server" id="Panel">
         <ContentTemplate>
             <asp:Button runat="server" id="upd" onclick="updButton_Click" 
                   text="click to update" />
         </ContentTemplate>
   </asp:UpdatePanel>
</form>

In code behind updButton_Click takes a long time to update, during the period you will see Loading... on the page, you can change the text to a <img src="blabla" /> to make it more like a ProgressBar(such as a GIF moving-bar image)

Cheng Chen
  • 42,509
  • 16
  • 113
  • 174