Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Setting the <code>TargetControlID</code> of the <code>ModalPopupExtender</code> basically trigger the client side Show function of that ModalPopup when the control is clicked. So you need to wire up the controls yourself.</p> <p>First, since the <code>ModalPopupExtender</code> need a <code>TargetControlID</code>, you should add a dummy control to link the modal popup to :</p> <pre><code>&lt;asp:Button runat="server" ID="HiddenTargetControlForModalPopup" style="display:none"/&gt; </code></pre> <p>And link the <code>ModalPopupExtender</code> <code>TargetControlID</code> to it</p> <pre><code>&lt;asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel1" CancelControlID="btnCancel" OnCancelScript="HideModalPopup()" TargetControlID="HiddenTargetControlForModalPopup"&gt; &lt;/asp:ModalPopupExtender&gt; </code></pre> <p>So the <code>ModalPopupExtender</code> now 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.</p> <pre><code>&lt;script type="text/javascript"&gt; var ModalPopup='&lt;%= ModalPopupExtender1.ClientID %&gt;'; function ShowModalPopup() { // show the Popup $find(ModalPopup).show(); } &lt;/script&gt; </code></pre> <p>Then you should map the <code>OnClientClick</code> event of the control in your <code>gridview</code> to this javascript function. From your code, I see that you use a <code>asp:HyperLink</code>, I don't think it support the <code>OnClientClick</code> event, so you probably need to switch it to a <code>asp:LinkButton</code>.</p> <pre><code>&lt;asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="ShowModalPopup()" /&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload