<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
BulletedList Control
File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void lb_SelectedIndexChanged(object sender, EventArgs e){
ListBox lb = (ListBox)sender;
string strID = lb.ID;
string strValue = lb.SelectedValue;
switch (strID){
case "lbBulletStyle": BulletStyle style = (BulletStyle)Enum.Parse(typeof(BulletStyle), strValue);
bltList.BulletStyle = style;
if (style == BulletStyle.CustomImage)
{
bltList.BulletImageUrl = "A.bmp";
}
break;
case "lbFirstBulletNumber":
bltList.FirstBulletNumber = Convert.ToInt32(strValue);
break;
case "lbDisplayMode":
BulletedListDisplayMode displayMode = (BulletedListDisplayMode)Enum.Parse(typeof(BulletedListDisplayMode), strValue);
bltList.DisplayMode = displayMode;
break;
default:
break;
}
}
protected void bltList_Click(object sender, BulletedListEventArgs e){
BulletedList b = (BulletedList)sender;
tdMessage.InnerHtml = "Selected index: " + e.Index.ToString() +
"
" +
"Selected value: " + b.Items[e.Index].Value +
"
";
}
}