How to use BulletedList in asp.net


BulletedList web server control

BulletedList is a Standard Toolbox control. It is very easy and essential control.

C# Code

  
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Drawing;
using System.Web.UI.WebControls;

namespace asptutorial
{
    public partial class blankpage : System.Web.UI.Page
    {

       protected void Page_Load(object sender, EventArgs e)
        {
            BulletedList1.BulletStyle = BulletStyle.Numbered;
            BulletedList2.BulletStyle = BulletStyle.Square;
            BulletedList3.BulletStyle = BulletStyle.UpperRoman;

            BulletedList1.ForeColor = System.Drawing.Color.PowderBlue;
            BulletedList2.ForeColor = System.Drawing.Color.PaleGoldenrod;
            BulletedList3.ForeColor = System.Drawing.Color.Red;

            BulletedList1.Items.Add("ABC");
            BulletedList1.Items.Add("DEF");
            BulletedList1.Items.Add("GHI");
            BulletedList1.Items.Add("JKL");
            BulletedList1.Items.Add("NMO");


            BulletedList2.Items.Add("ABC");
            BulletedList2.Items.Add("DEF");
            BulletedList2.Items.Add("GHI");
            BulletedList2.Items.Add("JKL");
            BulletedList2.Items.Add("NMO");


            BulletedList3.Items.Add("ABC");
            BulletedList3.Items.Add("DEF");
            BulletedList3.Items.Add("GHI");
            BulletedList3.Items.Add("JKL");
            BulletedList3.Items.Add("NMO");
           
        }

    }
}

HTML Code

<%@ Page Language="C#" %>  
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  
<script runat="server">  
    
   protected void Button1_Click(object sender, System.EventArgs e) {  
        Label1.Text = "Name: " +  
            TextBox1.Text.ToString() +  
            "<br />Emmail Address: " +  
            TextBox2.Text.ToString() +  
            "<br />Password: " +  
            TextBox3.Text.ToString();  
    }  
</script>  
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title> Button Control </title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
          <asp:BulletedList ID="BulletedList1" runat="server" BulletStyle="Numbered" ForeColor="PowderBlue">  
          <asp:ListItem>ABC</asp:ListItem>  
          <asp:ListItem>DEF</asp:ListItem>  
          <asp:ListItem>GHI</asp:ListItem>  
          <asp:ListItem>JKL</asp:ListItem> 
          <asp:ListItem>NMO</asp:ListItem>  
         </asp:BulletedList> 
         
          <asp:BulletedList ID="BulletedList2" runat="server" BulletStyle="Square" ForeColor="PaleGoldenrod">  
           <asp:ListItem>ABC</asp:ListItem>  
          <asp:ListItem>DEF</asp:ListItem>  
          <asp:ListItem>GHI</asp:ListItem>  
          <asp:ListItem>JKL</asp:ListItem> 
          <asp:ListItem>NMO</asp:ListItem> 
         </asp:BulletedList> 
         
          <asp:BulletedList ID="BulletedList3" runat="server" BulletStyle="UpperRoman" ForeColor="Red">  
          <asp:ListItem>ABC</asp:ListItem>  
          <asp:ListItem>DEF</asp:ListItem>  
          <asp:ListItem>GHI</asp:ListItem>  
          <asp:ListItem>JKL</asp:ListItem> 
          <asp:ListItem>NMO</asp:ListItem>  
         </asp:BulletedList>  
    
    </div>
    </form>
</body>
</html>
Output
How to use BulletedList in asp.net

Share this article on