Creating a links column in an asp datagrid

G

Guest

I have a datatable that contains a number of web addresses as type nvarchar
(eg 'www.msdn.com').
I want to use these as hyperlinks in a datagrid column.

Whats the best way to do this? How can I set the NavigateURL property for
each row of a HyperLinkField column dynamically? Is this even the best way to
do it?

Thanks
 
G

Guest

Howdy,

<asp:DataGrid runat="server" ID="klapa">
<Columns>
<asp:HyperLinkColumn
DataNavigateUrlField="ColumnContainingLinks"
DataNavigateUrlFormatString="http://{0}"
DataTextField="ColumnContainingLinks"
DataTextFormatString="{0}"/>
</Columns>
</asp:DataGrid>

Hope this helps
 
G

Guest

Thanks mate, your a star. It worked fine.

Milosz Skalecki said:
Howdy,

<asp:DataGrid runat="server" ID="klapa">
<Columns>
<asp:HyperLinkColumn
DataNavigateUrlField="ColumnContainingLinks"
DataNavigateUrlFormatString="http://{0}"
DataTextField="ColumnContainingLinks"
DataTextFormatString="{0}"/>
</Columns>
</asp:DataGrid>

Hope this helps
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top