1

我在 gridview 行 TemplateField 中有一个带有 UpdateProgress、UpdatePanel 和 Linkbutton 的 Gridview。当我单击链接按钮时,UpdateProgress 应该可以工作,但在我的情况下不行。

这是代码:

<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
                AutoGenerateColumns="False" BackColor="White" BorderColor="#CC9966"
                BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="CustomerID"
                onpageindexchanging="GridView1_PageIndexChanging" Width="500px"
                onrowcommand="GridView1_RowCommand"
                onrowdatabound="GridView1_RowDataBound">
                <Columns>
                    <asp:BoundField DataField="CustomerID" HeaderText="Customer ID" />
                    <asp:BoundField DataField="CompanyName" HeaderText="Company" />
                    <asp:BoundField DataField="City" HeaderText="City" />
                    <asp:TemplateField>
                        <ItemTemplate>

                            <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel2" >
                                    <ProgressTemplate>
                                            <asp:Image ID="Image1" runat="server" ImageUrl="~/images/ajax-loader.gif" />
                                    </ProgressTemplate>
                                </asp:UpdateProgress>

                            <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode= "Conditional" >
                                <ContentTemplate>
                                    <asp:LinkButton ID="lbtnExecute" runat="server" CommandArgument="<%# ((System.Web.UI.WebControls.GridViewRow)(Container)).DataItemIndex + 1 %>"
                                        CommandName="Execute">Execute</asp:LinkButton>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="lbtnExecute" EventName="Click" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
                <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
                <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                <RowStyle BackColor="White" ForeColor="#330099" />
                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
                <SortedAscendingCellStyle BackColor="#FEFCEB" />
                <SortedAscendingHeaderStyle BackColor="#AF0101" />
                <SortedDescendingCellStyle BackColor="#F6F0C0" />
                <SortedDescendingHeaderStyle BackColor="#7E0000" />
            </asp:GridView>

我尝试删除:

AssociatedUpdatePanelID="UpdatePanel2"

但 UpdateProgress 显示在所有行中。我希望它只显示在我单击链接按钮的行上。

任何人都可以帮忙吗?

4

0 回答 0