Is there a way to make a column in DataGrid or Datalist a hyperlink? I tried <asp:HyperLink> and <a href="somelink"> but none of them worked. they always display the contents as plain text.
Thanks in advance.
Printable View
Is there a way to make a column in DataGrid or Datalist a hyperlink? I tried <asp:HyperLink> and <a href="somelink"> but none of them worked. they always display the contents as plain text.
Thanks in advance.
Hi,
you have to create a <asp:templatecolumn>...
here's an example
you could use any asp tags in there like checkbox, linkbutton....Code:<asp:datagrid runat="server" id="table1">
<asp:templatecolumn runat="server" id="template1">
<itemtemplate>
<asp:hyperlink runat="server" id="link1">Click Me</asp:hyperlink>
</itemtemplate>
<asp:templatecolumn>
</asp:datagrid>
but remember that in order to access their properties, you have to do a FindControl on the hyperlink ID....
Steve