Creating a links column in an asp datagrid

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
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
 
Back
Top