BulletedListEventArgs 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为 Click 控件的 BulletedList 事件提供数据。
public ref class BulletedListEventArgs : EventArgs
public class BulletedListEventArgs : EventArgs
type BulletedListEventArgs = class
inherit EventArgs
Public Class BulletedListEventArgs
Inherits EventArgs
- 继承
示例
下面的示例演示如何为 Click 控件的 BulletedList 事件指定和编码事件处理程序。 单击列表项时,页面上的 中 Label 会显示一条消息。
<%@ Page Language="C#" %>
<!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>BulletedList Click Example</title>
<script runat="server">
void ItemsBulletedList_Click(object sender, System.Web.UI.WebControls.BulletedListEventArgs e)
{
// Change the message displayed in the label based on the index
// of the list item that was clicked.
switch (e.Index)
{
case 0:
Message.Text = "You clicked list item 1.";
break;
case 1:
Message.Text = "You clicked list item 2.";
break;
case 2:
Message.Text = "You clicked list item 3.";
break;
default:
throw new Exception("You did not click a valid list item.");
break;
}
}
</script>
</head>
<body>
<h3>BulletedList Click Example</h3>
<form id="form1" runat="server">
<p>Click on an item in the list to raise the Click event.</p>
<asp:BulletedList id="ItemsBulletedList"
BulletStyle="Disc"
DisplayMode="LinkButton"
OnClick="ItemsBulletedList_Click"
runat="server">
<asp:ListItem Value="http://www.cohowinery.com">Coho Winery</asp:ListItem>
<asp:ListItem Value="http://www.contoso.com">Contoso, Ltd.</asp:ListItem>
<asp:ListItem Value="http://www.tailspintoys.com">Tailspin Toys</asp:ListItem>
</asp:BulletedList>
<asp:Label id="Message"
Font-Size="12"
Width="168px"
Font-Bold="True"
runat="server"
AssociatedControlID="ItemsBulletedList"/>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!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>BulletedList Click Example</title>
<script runat="server">
Sub ItemsBulletedList_Click(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.BulletedListEventArgs)
' Change the message displayed in the label based on the index
' of the list item that was clicked.
Select Case (e.Index)
Case 0
Message.Text = "You clicked list item 1."
Case 1
Message.Text = "You clicked list item 2."
Case 2
Message.Text = "You clicked list item 3."
Case Else
Throw New Exception("You did not click a valid list item.")
End Select
End Sub
</script>
</head>
<body>
<h3>BulletedList Click Example</h3>
<form id="form1" runat="server">
<p>Click on an item in the list to raise the Click event.</p>
<asp:BulletedList id="ItemsBulletedList"
BulletStyle="Disc"
DisplayMode="LinkButton"
OnClick="ItemsBulletedList_Click"
runat="server">
<asp:ListItem Value="http://www.cohowinery.com">Coho Winery</asp:ListItem>
<asp:ListItem Value="http://www.contoso.com">Contoso, Ltd.</asp:ListItem>
<asp:ListItem Value="http://www.tailspintoys.com">Tailspin Toys</asp:ListItem>
</asp:BulletedList>
<asp:Label id="Message"
Font-Size="12"
Width="168px"
Font-Bold="True"
runat="server"
AssociatedControlID="ItemsBulletedList"/>
</form>
</body>
</html>
注解
单击 Click 控件中的 BulletedList 链接按钮时,将引发 该事件。
有关 BulletedListEventArgs 类的实例的初始属性值列表,请参见 BulletedListEventArgs 构造函数。
构造函数
BulletedListEventArgs(Int32) |
初始化 BulletedListEventArgs 类的新实例。 |
属性
Index |
获取 BulletedList 控件中引发事件的列表项的索引。 |
方法
Equals(Object) |
确定指定对象是否等于当前对象。 (继承自 Object) |
GetHashCode() |
作为默认哈希函数。 (继承自 Object) |
GetType() |
获取当前实例的 Type。 (继承自 Object) |
MemberwiseClone() |
创建当前 Object 的浅表副本。 (继承自 Object) |
ToString() |
返回表示当前对象的字符串。 (继承自 Object) |