I am using a Repeater control to display a list of article titles contained in a database. Some of these have a URL link to the full article. In the case where there is a URL I want to make the title a link to that URL.
...
<asp:Repeater ID="dgArticlesRep" Runat="server">
<HeaderTemplate>
<ol>
</HeaderTemplate>
<ItemTemplate>
<li><a href="<%# DataBinder.EvalContainer.DataItem, "URL" %>"><%# DataBinder.Eval(Container.DataItem, "title" %></a></li>
</ItemTemplate>
<FooterTemplate>
</ol>
</FooterTemplate>
</asp:Repeater>
...
Retrieving the data and binding it to the control is no problem but how after being bound do I pick out individual bits of data from the control? I need to access the URL field to determine if the title should be a link or not.
Any help on this would be greatly appreciated.
...
<asp:Repeater ID="dgArticlesRep" Runat="server">
<HeaderTemplate>
<ol>
</HeaderTemplate>
<ItemTemplate>
<li><a href="<%# DataBinder.EvalContainer.DataItem, "URL" %>"><%# DataBinder.Eval(Container.DataItem, "title" %></a></li>
</ItemTemplate>
<FooterTemplate>
</ol>
</FooterTemplate>
</asp:Repeater>
...
Retrieving the data and binding it to the control is no problem but how after being bound do I pick out individual bits of data from the control? I need to access the URL field to determine if the title should be a link or not.
Any help on this would be greatly appreciated.