Add Attributes to a Hyperink Control within The Gridview RowDataBound Event

Posted on 2007-10-18
Last Modified: 2010-05-18
Hi All

I have a template column within my Gridview which contains a hyperlink control. I need to add the following jscript to it, please could anyone suggest a way:

onClick="exopen('mypage.aspx');return false;"

I envisaged it being done within the Gridview's RowDataBound event but not sure on the approach.

Question by:rito1
    LVL 96

    Accepted Solution

    You could do that in the HTML designer for the GridView, since it is not a dynamic string.

    LVL 7

    Expert Comment

    by:Abu Hamdan
    Try solution on this thread:
    LVL 1

    Author Comment


    The link should look like this so i need to add the attribute onclick..

    <a id="ctl00_ContentPlaceHolder1_GridView1_ctl02_HyperLink1" onClick="exopen('mypage.aspx');return false;" href="mypage.aspx"><img src="trolley.gif" alt="buy" style="border-width:0px;" /></a>
    LVL 1

    Author Comment

    ... OnClientClick doesn't seem to be supported on a HyperLink control

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now