Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4623606
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:00:43+00:00 2026-05-22T03:00:43+00:00

How can I set TragetContriID to a HyperLink that is inside a GridView ?

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:00:44+00:00Added an answer on May 22, 2026 at 3:00 am

    Setting the TargetControlID of the ModalPopupExtender basically 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 ModalPopupExtender need a TargetControlID, you should add a dummy control to link the modal popup to :

    <asp:Button runat="server" 
                ID="HiddenTargetControlForModalPopup" 
                style="display:none"/> 
    

    And link the ModalPopupExtender TargetControlID to it

    <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
                            PopupControlID="Panel1" 
                            CancelControlID="btnCancel" 
                            OnCancelScript="HideModalPopup()"  
                            TargetControlID="HiddenTargetControlForModalPopup">
    </asp:ModalPopupExtender>
    

    So the ModalPopupExtender 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.

    <script type="text/javascript">
         var ModalPopup='<%= ModalPopupExtender1.ClientID %>';
    
         function ShowModalPopup() {
             //  show the Popup     
             $find(ModalPopup).show();
         }
    </script>   
    

    Then you should map the OnClientClick event of the control in your gridview to this javascript function. From your code, I see that you use a asp:HyperLink, I don’t think it support the OnClientClick event, so you probably need to switch it to a asp:LinkButton.

    <asp:LinkButton ID="LinkButton1" runat="server" 
                    OnClientClick="ShowModalPopup()" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I set a dropdownlist control's height in C#? I tried this, but
I can set data in JTable constructor, and then user can change this data
In Vim I can :set wrapscan so that when I do an incremental search,
I can set the background of each TabItem with TabItem.Background, but when that tab
I can set up my EC2 instances so that certain users other than myself
I can set the ToolTip property of a ListView control, but that's for the
I knew that we can set innodb as engine tables. But can we add
I can set language modes for javascript, css, html, json by this construction: var
I can set the margin of a stackpanel in code-behind like this: StackPanel sp2
I can set the parent's status bar text with this function I wrote void

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.