将数据插入数据库时​​更新进度条

Update Progress Bar While Inserting Data Into Database

foreach (DataRow row in Employee.Rows)
{
    //insert record into database. when record entered i need to update the progress 
    //bar on client side.
}

如何解决我的问题?

Update Panel 中使用您的插入按钮并将 Update Progress 分配给您的 Update Panel,如下所示。

        <asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel" runat="server">
            <ProgressTemplate>
                <div>
                    <asp:Image ID="Image" runat="server" ImageAlign="Middle" ImageUrl="Images/loading.gif" />
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
        <asp:UpdatePanel ID="UpdatePanel" UpdateMode="Conditional" runat="server">
            <ContentTemplate>
                <asp:Button ID="Button1" runat="server" Text="Button" />
            </ContentTemplate>
        </asp:UpdatePanel>