DataGrid HyperLink Columns

  • Thread starter Thread starter Jeremy
  • Start date Start date
J

Jeremy

In a datagrid which contains a hyperlink column, can I programatically
change a specific row's hyperlink ?
The hyperlink build in by the designer applies to all rows - I'd like to
change each row's hyperlink based on the contents of that row itself.
 
can do it using template columns

i have found html hyperlinks work better than asp:hyperlinks

<asp:datagrid bollocks blah blah.....


<asp:TemplateColumn HeaderText="Comments">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<a href='Comment.aspx?issueID=<%#
DataBinder.Eval(Container.DataItem, "issue_id") %>'>
<%# DataBinder.Eval(Container.DataItem, "comments") %>
</a>
</ItemTemplate>
</asp:TemplateColumn>

<end dg...>

to call this
you just point your dg datasrc at your dataset or xml or whatever
and then call dg.databind
which is where the stuff in the <%# %> gets called and not before

in this case 'issue_id' and 'comments' are column names in my dataset
 
Back
Top