Another easy one: make a column into a hyperlink.

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
 
G

Guest

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
 
J

John Timney \(Microsoft MVP\)

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
 
J

Jason

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.
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top