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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:46:55+00:00 2026-05-23T11:46:55+00:00

I’m trying to bind a GridView HyperLinkField such that the bound column is used

  • 0

I’m trying to bind a GridView HyperLinkField such that the bound column is used as a parameter value in the URL. Pretty standard stuff – nothing fancy, but the binding fails when the bound column contains a colon, i.e. :. I’m my particular case, this value is a string representing a duration of time, e.g. “14:35”, or “1:07:19”.

Here’s my GridView, with the time value bound to the HyperLinkField url.

<asp:GridView ID="ResultsGridView" runat="server" AutoGenerateColumns="False" 
    DataSourceID="ResultsDataSource" EnableModelValidation="True" 
        AllowPaging="True">
    <Columns>
        <asp:BoundField DataField="Year" HeaderText="Year" SortExpression="Year" />
        <asp:HyperLinkField DataNavigateUrlFields="RunTime" 
            DataTextField="RunTime" HeaderText="Hyperlink" 
            DataNavigateUrlFormatString="LinkedPage.aspx?param={0}" />
        <asp:BoundField DataField="RunTime" HeaderText="Time" 
            SortExpression="RunTime" />
        <asp:BoundField DataField="FullName" HeaderText="Name" 
            SortExpression="FullName" ReadOnly="True" />
    </Columns>
</asp:GridView>

It produces HTML like this. Note that the <a> tags have no href attribute.

<tr>
    <td>2010</td><td><a>34:58</a></td><td>34:58</td><td>Joe Schmoe</td>
</tr><tr>
    <td>2010</td><td><a>35:30</a></td><td>35:30</td><td>Rod Krueger</td>
</tr><tr>
    <td>2010</td><td><a>35:38</a></td><td>35:38</td><td>Mike Johnson</td>
</tr>

But if I switch the bound field from RunTime to Year, i.e. to a column that doesn’t contain a colon in the values, it works as expected. Take the GridView above, and change the DataNavigateUrlFields attribute of the HyperLinkField, like so:

    <asp:HyperLinkField DataNavigateUrlFields="Year" 
        DataTextField="RunTime" HeaderText="Hyperlink" 
        DataNavigateUrlFormatString="LinkedPage.aspx?param={0}" />

And now the HTML output is correct, like this:

<tr>
    <td>2010</td><td><a href="LinkedPage.aspx?param=2010">34:58</a></td><td>34:58</td><td>Joe Schmoe</td>
</tr><tr>
    <td>2010</td><td><a href="LinkedPage.aspx?param=2010">35:30</a></td><td>35:30</td><td>Rod Krueger</td>
</tr><tr>
    <td>2010</td><td><a href="LinkedPage.aspx?param=2010">35:38</a></td><td>35:38</td><td>Mike Johnson</td>
</tr><tr>

So the nut of my question is this: how do I bind a data column with values that contain a colon to the URL of a HyperLinkField? Or, failing that, create the same bound hyperlink by another method?

Changing the format of the data to not include a colon would be a last resort, because LinkedPage.aspx expects the parameter value in that format, and it’s already written, tested and in use.

  • 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-23T11:46:56+00:00Added an answer on May 23, 2026 at 11:46 am
    <asp:TemplateField HeaderText="Hyperlink">
            <ItemTemplate>
                <asp:HyperLink ID="HyperLink1" runat="server" 
                    NavigateUrl='<%# Eval("RunTime", @"LinkedPage.aspx?param={0:hh\:mm}") %>' 
                    Text='<%# Eval("RunTime", @"{0:hh\:mm}") %>'></asp:HyperLink>
            </ItemTemplate>
        </asp:TemplateField>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.