I have a public class and a public list.
public List<yahoo> yahooRec = new List<yahoo>();
public class yahoo
{
public string url { get; set; }
public string title { get; set; }
public string descripton { get; set; }
}
My list get Its values In a foreach loop. I just want to use my list in a repeater
<asp:Repeater id="Rep" runat="server">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%= yahoorec.url %>' Text='<%= yahoorec.title %>' />
<p> <%= yahoorec.description %> </p>
</ItemTemplate>
</asp:Repeater>
But it doesnt work.Anybody can help me?
You can use:
<asp:Repeater ID="Rep" runat="server">
<ItemTemplate>
<a href="<%# Eval("url") %>"><%# Eval("title") %></a>
<p><%# Eval("Url")%> </p>
</ItemTemplate>
</asp:Repeater>
Or, you can hook into the Rep.ItemDataBound event, find your controls, and populate them in the code-behind.