views:

12

answers:

0

How do I use a GridView TemplateField containing a LinkButton that is to display the modal on click? I have rows of data that I want to update the details of when clicking the 'Edit' LinkButton in that row. There is a bunch of data I need to load via codebehind just before the Modal displays.

I was trying the following, but I can't do Modal1.Show() in the event handler because it's in a TemplateField:

<ItemTemplate>
  <asp:Button runat="server" ID="HiddenForModal" style="display: none" />
    <ajaxToolkit:ModalPopupExtender ID="Modal1" runat="server" TargetControlID="HiddenForModal" PopupControlID="pnlModal" />
    <asp:LinkButton ID="btnEdit" runat="server" Text="Edit" onclick="btnEdit_Click" />
    <asp:LinkButton ID="btnDelete" runat="server" Text="Delete"></asp:LinkButton>
</ItemTemplate>

Thanks, Mark