Home All Groups Group Topic Archive Search About

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

Author
30 May 2005 9:45 PM
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.
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Author
31 May 2005 7:36 AM
Mona
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]

Show quoteHide quote
"Nathan Sokalski" <njsokal***@hotmail.com> wrote in message news:%231wGpDWZFHA.4008@tk2msftngp13.phx.gbl...
>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.
> --
> Nathan Sokalski
> njsokal***@hotmail.com
> http://www.nathansokalski.com/
>
>