将ModalPopupExtender的TargetControlID设置为DataGrid标头中的Button

时间:2010-01-10 16:22:52

标签: asp.net gridview modalpopupextender

我试图通过在数据网格标题中添加一个按钮,将一个ModalPopup添加到GridView中:

<asp:GridView ID="GridViewTradeDetail" />
    <Columns>
        <asp:TemplateField HeaderText="B/S">
            <HeaderTemplate>
                <asp:Button ID="ButtonShowBuySellPopup" runat="server" Text="Set B/S" />
            </HeaderTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("buy_sell") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# Bind("buy_sell") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="trade_date" HeaderText="TD" />
    </Columns>
</asp:GridView>

...

<asp:Panel ID="PanelBuySell" runat="server">
    ... panel content ...
</asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderBuySell" runat="server"
    TargetControlID="ButtonShowBuySellPopup" PopupControlID="PanelBuySell" />
<asp:Button ID="ButtonShowBuySellPopup" runat="server" Text="Set B/S" />

但是我得到一个错误,ModalPopupExtender无法找到按钮ButtonShowBuySellPopup(如果我将按钮移出网格标题就可以了)。

如何将弹出窗口链接到Gridiew标题中的按钮(或更好的文本链接)?

谢谢

赖安

0 个答案:

没有答案