How can I set TragetContriID to a HyperLink that is inside a GridView?
I tried this :
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
PopupControlID="Panel1"
CancelControlID="btnCancel"
OnCancelScript="HideModalPopup()"
TargetControlID="GridView1$HyperLink1">
</asp:ModalPopupExtender>
But I have an error: that there is no GridView1$HyperLink1
Setting the
TargetControlIDof theModalPopupExtenderbasically trigger the client side Show function of that ModalPopup when the control is clicked. So you need to wire up the controls yourself.First, since the
ModalPopupExtenderneed aTargetControlID, you should add a dummy control to link the modal popup to :And link the
ModalPopupExtenderTargetControlIDto itSo the
ModalPopupExtendernow has a target that do nothing. Now we now need to do the target’s job. You need a javascript function to show the ModalPopup from client side.Then you should map the
OnClientClickevent of the control in yourgridviewto this javascript function. From your code, I see that you use aasp:HyperLink, I don’t think it support theOnClientClickevent, so you probably need to switch it to aasp:LinkButton.