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 4621230
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:40:15+00:00 2026-05-22T02:40:15+00:00

I have a Gridview with a template for this Hyperlink: <asp:TemplateField HeaderText=Notes ItemStyle-CssClass=NoMargin NoPadding

  • 0

I have a Gridview with a template for this Hyperlink:

        <asp:TemplateField HeaderText="Notes" ItemStyle-CssClass="NoMargin NoPadding" SortExpression="lineNotes">
            <ItemTemplate>
                <asp:HyperLink id="notesHl" runat="server" text='<%# Bind("lineNotes") %>' Font-Underline="true" Font-Bold="true"></asp:HyperLink>
            </ItemTemplate>
            <ItemStyle Font-Size="Smaller" Height="10px" Width="10px" Wrap="True" />
        </asp:TemplateField>

Then jQuery that creates a Modal dialogue called by Popup();

    $(document).ready(function () {
        // increase the default animation speed to exaggerate the effect
        $.fx.speeds._default = 1000;
        $(function () {
            $("#divLineItemComments").dialog({
                autoOpen: false,
                show: "blind",
                hide: "explode",
            width: 900,
            height: 500
            });
        });

        $("#_ctl0_ContentPlaceHolder1_cwgPhysical__ctl3_notesHl").click(function () {
            $("#divLineItemComments").dialog("open");
            return false;
        });
    });

    function Popup() {
        $("#divLineItemComments").dialog("open");
        return false;                       
    }

For testing, I hard coded the generated name of the first link in the gridview:

_ctl0_ContentPlaceHolder1_cwgPhysical__ctl3_notesHl

Because ASP.NET generates the id’s dynamically, I need to dynamically bind the click event of the hyperlinks. So that it works with the naming used by ASP.NET. I could hardcode up to XX generated names (and hope they always generate the same names). This seems to be a terrible solution…

How can I get the jQuery to bind my Clicks to my Hyperlinks?

Hooking into the rowbound may work, but I don’t know how to bind jQuery here

protected void cwgPhysical_RowDataBound(object sender, GridViewRowEventArgs e)
{
  Hyperlink.NavigateUrl = "javascript:Popup();";//this might work somehow...
}
  • 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-22T02:40:16+00:00Added an answer on May 22, 2026 at 2:40 am

    You can actually solve this with a rather low-tech solution: simply make a dummy cssClass and apply it to all your hyperlinks generated. Then you have a really simple selector:

    $('.myDummyCssClass').click(...);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this template field inside a gridview. <asp:TemplateField ItemStyle-HorizontalAlign=Center> <ItemTemplate> <asp:ImageButton ID=ImageButton2 ImageUrl=~/images/DeleteRecord.gif
I have an ASP.NET GridView that uses an EmptyDataTemplate. This template is used to
In a gridview I have the following Template Field containing a textbox <asp:TemplateField ShowHeader=true
I have a ASP.NET GridView that uses template columns and user controls to allow
I have an ASP.NET GridView with a DropDownList (in an Item Template) and a
I have a GridView defined like this: <asp:GridView ID=myGridView ruant=server> <asp:BoundField DataField=myField /> <asp:CommandField
i have a gridview table like this... <div> <asp:GridView ID=GridView1 runat=server AllowSorting=true OnSorting=TaskGridView_Sorting >
I dynamically create gridview, and in this grid I have template field also field.HeaderTemplate
I have a gridview and one of the template fields is an asp image
in a GridView (ASP.NET/C#), I have a number of template fields - the 2

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.