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.
 
Soory I'll be more specific. How do I do this in handwritten asp.net code
rather than in Visual Studio.

Chris Kennedy said:
How do I set them?
 
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
 

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