Link in a DataGrid

M

Matthias S.

Hi,

I've got a DataGrid displaying ID, Name, Email and Notes field from a
table. Now I'd like to put a Hyperlink under the value in the
name-column (or, if possible, under the complete row) which will point
to a details-page with the value from the ID field built into the link.

Sample:
ID|Name|Email|Notes
213|Peter Parker|peteratspidernetdotcom|be brave
214|Robin Hood|robinatsherwooddotcom|be smart

The Links id like to build should look somewhat like
"herodetails.aspx?id=213".

Could somebody point me into the righ direction? Thanks in advance!
 
B

Brock Allen

You'll need a HyperLinkColumn instead of a BoundColumn for your name column:

<asp:HyperLinkColumn DataTextField="NameColumn" DataNavigateUrlField="IDColumn"
DataNavigateUrlFormatString="Details.aspx?ID={0}"></asp:HyperLinkColumn>
 
M

Matthias S.

Thanks Brock, that helped.

Matthias

Brock said:
You'll need a HyperLinkColumn instead of a BoundColumn for your name
column:

<asp:HyperLinkColumn DataTextField="NameColumn"
DataNavigateUrlField="IDColumn"
DataNavigateUrlFormatString="Details.aspx?ID={0}"></asp:HyperLinkColumn>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top