BulletedList control is used to display the data in a list prefixed with bullet characters.
The item can be statically written or can be bound with the datasource.
When it is rendered on the page, it is implemented through <table> HTML tag.
Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc.
are implemented generally through style properites of <ul> tag, However it depends on BulletStyle property.
Following are some important properties that are very useful.
DisplayMode |
HyperLink/LinkButton/Text. Determines how to display the items.
|
FirstBulletNumber |
Sets a starting number for Bulleted list when BulletStyle is set to Numbering.
|
Items |
Gets the colleciton of the items in the list control.
|
BulletStyle |
Circle/CustomImage/Disc/LowerAlpha/LowerRoman/Numbered/Square/UpperAlpha/UpperRoman. Determines the style of the bullet.
|
AppendDataBoundItems |
Determines whether statically defined items should remain and shown when adding items dynamically.
|
DataTextField |
Name of the field to set as items text. Used when DisplayMode is Hyperlink or LinkButton.
|
DataValueField |
Name of the field to set as items value. Used when DisplayMode is Hyperlink or LinkButton.
|
BulletImageUrl |
Used to set the Bullet Image when BulletStyle is CustomImage.
|
DEMO : BulletList
|
Show Source Code
|
Static BulletList Control, Bullet style is default
|
Static BulletList Contorl, Bullet style is LowerAlpha
- Item 1
- Item 2
- Item 3
|
Static BulletList Control, DisplayMode is Hyperlink
Static BulletList Control, DisplayMode is LinkButton
Dynamic BulletList Control, BulletStyle is Square
- Item Text 0
- Item Text 1
- Item Text 2
- Item Text 3
|
Dynamic BulletList Control with DataBound, BulletStyle is Numbered
- Name 0
- Name 1
- Name 2
- Name 3
- Name 4
- Name 5
- Name 6
- Name 7
- Name 8
- Name 9
|
|
|
// Static BulletedList Control, Bullet style is default<br />
<asp:BulletedList ID="BulletedList3" runat="Server" BorderColor="Blue" BorderWidth="1">
<asp:ListItem Text="Item 1"></asp:ListItem>
<asp:ListItem Text="Item 2"></asp:ListItem>
<asp:ListItem Text="Item 3"></asp:ListItem>
</asp:BulletedList>
// Static BulletList Contorl, Bullet style is LowerAlpha<br />
<asp:BulletedList ID="BulletedList4" runat="Server" BulletStyle="LowerAlpha">
<asp:ListItem Text="Item 1"></asp:ListItem>
<asp:ListItem Text="Item 2"></asp:ListItem>
<asp:ListItem Text="Item 3"></asp:ListItem>
</asp:BulletedList>
// Static BulletList Control, DisplayMode is Hyperlink
<asp:BulletedList ID="BulletedList5" runat="Server" DisplayMode="HyperLink"
BulletStyle="CustomImage" BulletImageUrl="~/images/fundaIcon.gif">
<asp:ListItem Text="Button" Value="button.aspx"></asp:ListItem>
<asp:ListItem Text="Label" Value="Label.aspx"></asp:ListItem>
<asp:ListItem Text="Radio" Value="radio.aspx"></asp:ListItem>
</asp:BulletedList>
// Static BulletList Control, DisplayMode is LinkButton
<asp:BulletedList ID="BulletedList6" runat="Server" DisplayMode="LinkButton">
<asp:ListItem Text="Button" Value="button.aspx"></asp:ListItem>
<asp:ListItem Text="Label" Value="Label.aspx"></asp:ListItem>
<asp:ListItem Text="Radio" Value="radio.aspx"></asp:ListItem>
</asp:BulletedList>
// Dynamic BulletList Control, BulletStyle is Square<br />
<asp:BulletedList ID="BulletedList7" runat="Server" BulletStyle="Square" DataTextField="Name" DataValueField="ID"></asp:BulletedList>
// Dynamic BulletList Control with DataBound, BulletStyle is Numbered<br />
<asp:BulletedList ID="BulletedList8" runat="Server" BulletStyle="Numbered" DataTextField="Name" DataValueField="ID"></asp:BulletedList>
|