Properties
1. BulletStyle
2. FirstBulletNumber
3. DisplayMode-Text, HyperLink or LinkButton.
4. Traget- used when DisplayMode is HyperLink.
Example :-
WebForm1.aspx :-
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="_28_BulletedList.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>
<form id="form1" runat="server">
<div>
<asp:BulletedList ID="BulletedList1" runat="server" DisplayMode="LinkButton"
onclick="BulletedList1_Click">
<asp:ListItem Value="1">UK</asp:ListItem>
<asp:ListItem Value="2">US</asp:ListItem>
<asp:ListItem Value="3">India</asp:ListItem>
<asp:ListItem Value="4">France</asp:ListItem>
</asp:BulletedList>
</div>
</form>
</body>
</html>
WebForm1.aspx.cs :-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace _28_BulletedList
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void BulletedList1_Click(object sender, BulletedListEventArgs e)
{
ListItem li=BulletedList1.Items[e.Index];
Response.Write("Text = " + li.Text + ", ");
Response.Write("Value = " + li.Value + ", ");
Response.Write("Index = " + e.Index.ToString());
Response.Write("<br/>");
}
}
}
No comments:
Post a Comment