使用C#和asp.net的Web应用程序中的进度条

时间:2022-11-09 03:35:53

I need to have 2 progress bars in my application:

我需要在我的应用程序中有2个进度条:

  1. Circular graphical progress bar (busy indicator)
    • as shown in the link [15.1.3] when the page does a postback and
    • 如链接[15.1.3]所示,当页面进行回发时

  2. 当页面进行回发时,链接[15.1.3]中显示的圆形图形进度条(忙碌指示符)

  3. A determinate progress bar
    • as shown in the link [15.1.1] with showing a percentage when I update or load data into the grid which I use in my application.
    • 如链接[15.1.1]所示,当我将数据更新或加载到我在我的应用程序中使用的网格中时显示百分比。

  4. 链接[15.1.1]中显示的确定进度条,显示我更新或将数据加载到我在应用程序中使用的网格中时的百分比。

Can anyone help me with code snippets and how I can proceed with my .aspx and .aspx.cs files in order to obtain these progress bars for my application?

任何人都可以帮助我使用代码片段以及如何继续使用我的.aspx和.aspx.cs文件以获取我的应用程序的这些进度条?

1 个解决方案

#1


You can use an UpdateProgress control for the busy indicator, which is very easy:

您可以使用UpdateProgress控件来执行忙碌指示器,这非常简单:

   <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="0">
       <ProgressTemplate>
           <div>
               <img src="../Resources/Images/indicator.gif" />
               Loading...
           </div>
       </ProgressTemplate>
   </asp:UpdateProgress>

But a progress bar is going to require a bit more work. You'll need to run a background thread to do the work, and you'll then need to periodically post back to check the value of, say, session variable to get your current progress.

但进度条需要更多的工作。您需要运行后台线程来完成工作,然后您需要定期回发以检查会话变量的值以获取当前进度。

#1


You can use an UpdateProgress control for the busy indicator, which is very easy:

您可以使用UpdateProgress控件来执行忙碌指示器,这非常简单:

   <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="0">
       <ProgressTemplate>
           <div>
               <img src="../Resources/Images/indicator.gif" />
               Loading...
           </div>
       </ProgressTemplate>
   </asp:UpdateProgress>

But a progress bar is going to require a bit more work. You'll need to run a background thread to do the work, and you'll then need to periodically post back to check the value of, say, session variable to get your current progress.

但进度条需要更多的工作。您需要运行后台线程来完成工作,然后您需要定期回发以检查会话变量的值以获取当前进度。