DataGrid HyperLink Columns

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.
 
E

evolve

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
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top