[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

.NET c#:  Add link to BoundField

Posted on 2009-02-23
3
Medium Priority
?
1,713 Views
Last Modified: 2013-12-17
Hi All,

I have a BoundField that outputs an ID.  I want this to be a hyperlink.

e.g.

MyPage.aspx?ID=123


Many thanks


<Columns>
         <asp:BoundField DataField="ID" HeaderText="ID"/>
</Columns>

Open in new window

0
Comment
Question by:detox1978
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
theplonk earned 2000 total points
ID: 23716961
Just use a hyperlinkfield. And use the DataNavigationUrlFormatString property.

Set it to the url of the file plus the text "&{0}". This will replace {0} with the value of the field.

e.g. DataNavigateUrlFormatString= "/default.aspx&{0}"
<Columns>
    <asp:HyperLinkField HeaderText="ID" DataTextField="ID" DataNavigateUrlFields="ID" DataNavigateUrlFormatString= "/default.aspx&{0}" />
</Columns>

Open in new window

0
 
LVL 2

Author Comment

by:detox1978
ID: 23717020
Thanks that worked a treat....
0
 
LVL 8

Expert Comment

by:theplonk
ID: 23717068
that's no problem. anytime.
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

830 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