How to make Gridview Item Template field an href

Posted on 2007-08-01
Last Modified: 2007-08-01
How might I make a Gridview item template field into an href?

I've got the template editor open, and I'm looking at the [Label5] control in the template...I can't figure out how to wrap the

<a href = '  (label content) '> (label content) </a>

around it.

Any help with this would be appreciated.

Question by:codequest
    LVL 14

    Assisted Solution

    LVL 9

    Accepted Solution

    Hi codequest,

        <a href="<%# DataBinder.Eval(Container.DataItem, "URL") %>">
          <%# DataBinder.Eval(Container.DataItem, "Name") %></a>

    Hope this helps.
    LVL 2

    Author Comment

    chinu1310's was interesting, but a different syntax than I'm used to.  I went with noulouk's and it worked good.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    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…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    754 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

    19 Experts available now in Live!

    Get 1:1 Help Now