BulletedList control in ASP.NET

In this article we will learn how to use BulletedList control in ASP. NET.
  • 2735

 

In this article we will learn how to use BulletedList control in ASP. NET.

BulletedList control:

Displaying items in a bullet format is a good and clean presentation of data. The BulletedList control is used to create a list of items formatted with bullets. The order list like <ul> and <li> tags are frequently use especially when we want to display a list of items in list / point format.

Properties: BulletedList control has the following properties.

bullet.gif
 

Figure 1.

Items:

The collection of items in the list.

bullet1.gif
 

Figure 2.

DisplayMode:

  • HyperLink: Each list item is rendered as a link to another page.
  • LinkButton: Each list item is rendered by a LinkButton control.
  • Text: Each list item is rendered as plain text.
    bullet2.gif

    Figure 3.
     

    BorderStyle:

    Style of the border around the control. BorderStyle can be following type.

    1. Dotted
    2. Hashed
    3. Solid
    4. Double
    5. groove
    6. Ridge
    7. Inset
    8. Outset

    Figure 4.

     

    BulletStyle:

    This style are used for Bullets. BulletStyle can be following type.

    1. Numbered
    2. LowerAlpha
    3. UpperAlpha
    4. LowerRoman
    5. UpperRoman
    6. Disc
    7. circle
    8. Square
    9. CustomImage
    bullet3.gif

    Figure 5.

     

    For example:

    Drag BulletedList control on the form and set DisplayMode property on hyperlink. The page given below displays a list of links to other websites.

    bullet4.gif
     

    Figure 6.

    Now click on the source button of the design window.

     

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication31.WebForm1" %>

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

     

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head runat="server">

        <title></title>

    </head>

    <body>

    <h3><font face="Verdana">Bulleted List</font></h3>

     

        <form id="form1" runat="server">

        <div>

       

            <asp:BulletedList ID="BulletedList1" DisplayMode = HyperLink runat=server>

                <asp:ListItem Value="http://google.com">Search</asp:ListItem>

                <asp:ListItem Value="http://www.asp.net">ASP.NET</asp:ListItem>

                <asp:ListItem Value="http://vbdotnetheaven.com">VB.NET</asp:ListItem>

            </asp:BulletedList>

          </div>

        </form>

    </body>

    </html>


    Now save and run the application.

    bullet5.gif

    Figure 7.

    Numbered Bullet list:

    Set the property BulletStyle -> numbered.

    bullet7.gif
    Figure 8.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.