link on datagrid

  • Thread starter Thread starter Chris Kennedy
  • Start date Start date
C

Chris Kennedy

I have a datagrid bound to a datareader. One of the columns contains file
name. I would like a column which acts as a link and opens a link to the
file (normally a pdf). How would I do this?
 
You need to make a template column with a hyperlink control in item template
and databind the hyperlink to the name column.

Eliyahu
 
Eliyahu said:
You need to make a template column with a hyperlink control in item
template and databind the hyperlink to the name column.

Eliyahu

Or, even simpler, you could add a hyperlinkcolumn, and
set the DataTextField and DataNavigateUrlField properties
to the file name column.
 
How do I set them?

Riki said:
Or, even simpler, you could add a hyperlinkcolumn, and
set the DataTextField and DataNavigateUrlField properties
to the file name column.
 
The quickstart tutorials at www.asp.net will tell you exactly how to do
this. Look under "Web Controls Syntax Reference", section DataGrid.

HTH,
Premier JiangZemin

Chris Kennedy said:
Soory I'll be more specific. How do I do this in handwritten asp.net code
rather than in Visual Studio.
 
<asp:HyperLinkColumn DataNavigateUrlField="myUrlField" DataTextField="Name"
HeaderText="URL"></asp:HyperLinkColumn>

Riki
 
Back
Top