簡體   English   中英

在UpdatePanel'UpdatePanel3'中找不到觸發器ID為'imgbtn_excel_gridout'的控件

[英]A control with ID 'imgbtn_excel_gridout' could not be found for the trigger in UpdatePanel 'UpdatePanel3'

我正在使用此代碼,但無法正常工作。

1.當我從此代碼中刪除更新面板時,它將起作用,但在更新面板中,此代碼將不起作用。 2.我還使用按鈕的觸發器發送異步請求。

         <asp:GridView ID="GridView2" runat="server" ShowFooter="True" AutoGenerateColumns="False" 
             CellPadding="4" ForeColor="Black" AllowPaging="True" 
             onpageindexchanging="GridView2_PageIndexChanging" 
             onrowdatabound="GridView2_RowDataBound" 
             onselectedindexchanged="GridView2_SelectedIndexChanged" 
             DataKeyNames="id,date" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" 
                       BorderWidth="3px" CellSpacing="2" PageSize="5" GridLines="None">
             <Columns>
                <%-- <asp:BoundField DataField="date" HeaderText="DATE" DataFormatString="{0:MM/dd/yy}">
                --%>
                 <asp:BoundField DataField="Id" HeaderText="REF. ID">
                 <ItemStyle BackColor="#33CC33" BorderColor="Maroon" Font-Bold="True" 
                     Font-Italic="True" ForeColor="#CC3300" />
                 </asp:BoundField>
                 <asp:BoundField DataField="Name" HeaderText="AUTHO. NAME" />
                 <asp:BoundField DataField="ItemType" HeaderText="ITEM TYPE">
                 <HeaderStyle Width="100px" />
                 </asp:BoundField>
                 <asp:BoundField DataField="Quantity" HeaderText="QUANTITY">
                 <HeaderStyle Width="130px" />
                 </asp:BoundField>
                 <asp:BoundField DataField="Brand" HeaderText="BRAND" />
                 <asp:BoundField DataField="SubType" HeaderText="SUB TYPE">
                 <HeaderStyle Width="100px" />
                 </asp:BoundField>
                 <asp:BoundField DataField="Date" HeaderText="DATE"  
                     DataFormatString="{0:yyyy-MM-dd HH:mm:ss}">

                 <HeaderStyle Width="100px" />
                 </asp:BoundField>
                     <asp:TemplateField SortExpression="QuantityInPiece" HeaderText="Quantity In Piece" >
                     <ItemTemplate > <asp:Label ID="lblId" runat="server" Text='<%# Bind("QuantityInPiece") %>'></asp:Label> </ItemTemplate>
                       <FooterTemplate> 
                             <asp:ImageButton ID="imgbtn_excel_gridout" runat="server" 
                                 ImageUrl="~/images/excel.jpg" Width="20px" Height="15px" 
                                 onclick="imgbtn_excel_gridout_Click">
                         </asp:ImageButton>
                         </FooterTemplate> 
                     </asp:TemplateField>
             </Columns>
             <FooterStyle BackColor="#CCCCCC" BorderStyle="Solid" />
             <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
             <PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
             <RowStyle BackColor="White" />
             <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
             <SortedAscendingCellStyle BackColor="#F1F1F1" />
             <SortedAscendingHeaderStyle BackColor="#808080" />
             <SortedDescendingCellStyle BackColor="#CAC9C9" />
             <SortedDescendingHeaderStyle BackColor="#383838" />

             <SortedAscendingCellStyle BackColor="#E9E7E2"></SortedAscendingCellStyle>

             <SortedAscendingHeaderStyle BackColor="#506C8C"></SortedAscendingHeaderStyle>

             <SortedDescendingCellStyle BackColor="#FFFDF8"></SortedDescendingCellStyle>

             <SortedDescendingHeaderStyle BackColor="#6F8DAE"></SortedDescendingHeaderStyle>
         </asp:GridView>

                       <br />
       </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="imgbtn_excel_gridout" />
    </Triggers>
</asp:UpdatePanel>

您可以嘗試此處執行的方法:

ASP.NET-將UpdatePanel觸發器添加到gridview內的LinkBut​​ton

使用您的ImageButton控件而不是LinkBut​​ton。

暫無
暫無

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

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