Search code examples
c#asp.netrepeaterweb-controlsdatarepeater

ASP.net putting a dataitem in a repeater


I've got a:

  • Data repeater
  • Control in the repeater

And I'd like to put some values into the controls. At the moment I have a control in it as:

<asp:Repeater runat="server" ID="ArchiveEntryRepeater">
    snip
    <asp:HyperLink ID="HyperLink1" ToolTip="Comment on Some Entry Title Here" runat="server" NavigateUrl="~/Blog/7/How-to-know-when-this/Comments">
        <strong><%# DataBinder.Eval(Container.DataItem, "Comments")%></strong> Comments
    </asp:HyperLink>
    snip
</asp:Repeater> 

Which works fine, but I want to put

<%# DataBinder.Eval(Container.DataItem, "Title")%>

Into the NavigateURL property of the Hyperlink. Just putting it in doesn't seem to work!


Solution

  • You can always bind on the back end using the event itemdatabound. It has some advantages especially where the data is not a neat view or needs some type of major manipulation.