我在关闭gridview后按下按钮然后代码正常工作时出现问题但是当我在gridview中取一个按钮时会出现错误“System.InvalidOperationException:'ModalPopupExtender1'的TargetControlID无效。带ID的控件'btn_edit'无法找到。“我的代码是:
代码的
的AutoGenerateColumns = “假”
allowpaging = “真”
每页= “3”
宽度= “500px的”
ondatabound = “CustomersGridView_DataBound”
runat =“server”DataKeyNames =“CompanyFName”CellPadding =“4”ForeColor =“#333333”
网格线= “无” >
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="CompanyFName" HeaderText="CompanyFName"
SortExpression="CompanyFName" />
<asp:BoundField DataField="CompanySName" HeaderText="CompanySName"
SortExpression="CompanySName" />
<asp:templatefield>
</Columns>
<EditRowStyle BackColor="#7C6F57" />
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<pagerstyle forecolor="White"
backcolor="#666666" HorizontalAlign="Center"/>
<pagertemplate>
<table width="100%">
<tr>
<td style="width:70%">
<asp:label id="MessageLabel"
forecolor="Blue"
text="Select a page:"
runat="server"/>
<asp:dropdownlist id="PageDropDownList"
autopostback="true"
onselectedindexchanged="PageDropDownList_SelectedIndexChanged"
runat="server"/>
</td>
<td style="width:70%; text-align:right">
<asp:label id="CurrentPageLabel"
forecolor="Blue"
runat="server"/>
</td>
</tr>
</table>
</pagertemplate>
<RowStyle BackColor="#E3EAEB" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F8FAFA" />
<SortedAscendingHeaderStyle BackColor="#246B61" />
<SortedDescendingCellStyle BackColor="#D4DFE1" />
<SortedDescendingHeaderStyle BackColor="#15524A" />
</asp:gridview>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/eTimeTrackLite1.mdb"
SelectCommand="SELECT [CompanyFName], [CompanySName] FROM [Companies]">
</asp:AccessDataSource>
<asp:Button ID="Button1" runat="server" Text="Button" />
<asp:Panel ID="Panel1" runat="server" BackColor="#990099" Height="146px"
Width="403px">
<asp:Button ID="Button2" runat="server" Text="Button" />
</asp:Panel>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btn_edit" PopupControlID="Panel1" CancelControlID="Button2" X="280" Y="220">
<Animations>
<OnShowing>
<FadeIn Duration=".5" Fps="40" />
</OnShowing>
<OnShown>
<FadeIn Duration=".5" Fps="40" />
</OnShown>
<%-- neither animation works from code-behind --%>
<OnHiding>
<FadeOut Duration=".5" Fps="40" />
</OnHiding>
<OnHidden>
<FadeOut Duration=".5" Fps="40" />
</OnHidden>
</Animations>
</asp:ModalPopupExtender>