簡體   English   中英

在GridView中顯示Button的ProgressBar onclick

[英]To show ProgressBar onclick of Button inside GridView

我有一個GridView ,其中最后一列有一個加載數據的Button 這樣做大約需要2分鍾。所以,我需要用戶知道后端中正在執行某些功能,而不是屏幕凍結了。所以,我需要在GridView單擊該按鈕時顯示一個ProgressBar怎么做? ?

我搜索了一段時間,終於找到了它,

 <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>

只需命名按鈕的相同ID(在AsyncPostBackTriggerAssociatedUpdatePanelID controlID中使用),將相同的名稱命名為GridView

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM