Another easy one: make a column into a hyperlink.

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

I have an asp.net page that has a datagrid on it. The datagrid is populated
at runtime from Active Directory.

I need to set one of the columns as a hyperlink while appending a mailto to
the data within that particular column's cell.

That is, if the column is named 'Email' and one of the rows is
'(e-mail address removed)' I need to be able to click on
(e-mail address removed) and it will invoke a 'mailto:[email protected]'
as a hyperlink.

Thoughts?

Thanks in advance,

Jay
 
Well I know that in design mode you can format an item cell in the datagrid. So, to my knowledge what ever you can do in design mode, you can do through code. But, this may take a little more patience to do. I am intrested to see how this can be done as well
 
lookup the hyperlinkcolumn

<asp:DataGrid id="ContainerID" runat="server" autogeneratecolumns="false" >
<columns>
<asp:HyperLinkColumn
DataTextField="Email"
HeaderText="Email"
DataNavigateUrlFormatString="mailto:{0}"
DataNavigateUrlField="EmailField" />
</columns>
</asp:DataGrid>

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
 
It was the DataTextField="Email" I was missing to specify an existing data
column rather than creating a new one. Works like a charm.

Thanks a million John.
 
Back
Top