【问题标题】:To show ProgressBar onclick of Button inside GridView在 GridView 内显示 ProgressBar onclick
【发布时间】:2017-06-01 09:12:13
【问题描述】:

我有一个GridView,其中最后一列有一个Button,用于加载数据。 这样做需要 2 分钟。所以,我需要用户知道后端正在执行某些功能,而不是屏幕被冻结 所以,我需要在点击GridView 内的那个按钮时显示一个ProgressBar 该怎么做??

【问题讨论】:

    标签: c# asp.net gridview progress-bar updateprogress


    【解决方案1】:

    找了好久终于找到了,

     <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                                <ContentTemplate>
                                    <asp:GridView ID="Gridview" OnRowDataBound="Gridview_RowDataBound" OnRowCommand="Gridview_RowCommand" runat="server" Style="text-align: center" ShowFooter="true" Width="99%"
                                        AutoGenerateColumns="false">
                                        <Columns>
    
    
                                            <asp:TemplateField HeaderText="Total Customers" HeaderStyle-BackColor="#99CCCC">
                                                <ItemTemplate>
    
                                                    <asp:Button ID="btnCombine" CssClass="btn-primary btn" Text="Combine"
                                                        Font-Bold="true"
                                                        CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" CommandName="More"
                                                        Style="padding-top: 1%; padding-bottom: 1%; margin-top: 1px; margin-bottom: 1px" runat="server" />
    
                                                </ItemTemplate>
                                            </asp:TemplateField>
    
    
    
                                        </Columns>
    
                                        <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                                        <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                                        <RowStyle BackColor="White" ForeColor="#003399" />
                                        <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                                        <SortedAscendingCellStyle BackColor="#EDF6F6" />
                                        <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
                                        <SortedDescendingCellStyle BackColor="#D6DFDF" />
                                        <SortedDescendingHeaderStyle BackColor="#002876" />
                                    </asp:GridView>
                                </ContentTemplate>
                            </asp:UpdatePanel>
    
                            <asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel2">
                                <ProgressTemplate>
                                    <img src="images/progress_bar.gif" style="max-width: 250px" />
                                </ProgressTemplate>
                            </asp:UpdateProgress>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="btnAddi" EventName="Click" />
                        </Triggers>
                    </asp:UpdatePanel>
    

    只需将您在AsyncPostBackTriggerAssociatedUpdatePanelID 的controlID 中使用的按钮的ID 命名为相同的ID,您将GridView 放在同名中

    【讨论】:

      猜你喜欢
      • 2022-01-07
      • 2016-12-19
      • 2016-01-09
      • 2010-12-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-31
      相关资源
      最近更新 更多