How do I create an Unordered List (UL) with ASP.NET?

  • Thread starter Thread starter Nathan Sokalski
  • Start date Start date
N

Nathan Sokalski

I want to add a bulleted list to my document in ASP.NET. I know the HTML
code, and I have used the HtmlGenericControl, but is there an ASP.NET object
that can generate UL and LI tags from a set of ListItem objects, or maybe
some other collection? Thanks.
 
Hi Nathan,

You can use the ASP.NET Repeater control for this purpose.

you can use the following code snippet for creating an unordered list
using the Repeater control:

<ul>
<asp:Repeater ID="rpt1" Runat="server">
<ItemTemplate>
<li>
<%# DataBinder.Eval(Container.DataItem, "Item") %>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>

You can bind the Repeater to any Datasource or Collection Object such as a dataset or a datatable or an arraylistas per your need.

HTH

Mona[Grapecity]
 
Back
Top