我試圖在用戶單擊GridView中的LinkButton時顯示Modal Popup。 我爲測試放置了一個斷點,但它似乎沒有通過ModalPopupExtender.Show()事件,當我單擊GridView中的Linkbutton時。GridView中Modal Popup Extender的解決方案
protected void lnkItemName_Click(object sender, EventArgs e)
{<---Break Point
ModalPopupExtender.Show();
}
<asp:GridView ID="grvItem" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSourceItem" onrowdatabound="grvItem_RowDataBound"
DataKeyNames="ID">
<Columns>
<asp:TemplateField >
<ItemStyle Font-Size="10" />
<HeaderTemplate>
ITEM
</HeaderTemplate>
<ItemStyle Wrap="True" />
<ItemTemplate>
<asp:LinkButton ID="lnkItemName" runat="server" Text='<%# Eval("NAME") %>' CssClass="h7" Width="100" OnClick="lnkItemName_Click"></asp:LinkButton>
<asp:Panel ID="pnlItem" runat="server" Style="display: none" Width="400px" Height="400px" BackColor="White">
<div style="float: right;">
<asp:LinkButton ID="lnkClose" runat="server">Close</asp:LinkButton>
</div>
<asp:TextBox ID="txt" runat="server">asdf</asp:TextBox>
</asp:Panel>
<asp:ModalPopupExtender ID="extPerson" runat="server" TargetControlID="lnkItemName"
PopupControlID="pnlItem" DropShadow="true" CancelControlID="lnkClose" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>