Link in a DataGrid

  • Thread starter Thread starter Matthias S.
  • Start date Start date
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!
 
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>

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
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>

-Brock
DevelopMentor
http://staff.develop.com/ballen
 

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

Back
Top