BulletedList.Click 이벤트
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컨트롤의 링크 단추를 클릭할 BulletedList 때 발생합니다.
public:
event System::Web::UI::WebControls::BulletedListEventHandler ^ Click;
public event System.Web.UI.WebControls.BulletedListEventHandler Click;
member this.Click : System.Web.UI.WebControls.BulletedListEventHandler
Public Custom Event Click As BulletedListEventHandler
이벤트 유형
예제
다음 코드 예제에서는 지정 하 고 컨트롤의 이벤트에 대 한 Click 이벤트 처리기를 코딩 하는 방법을 보여 줍니다 BulletedList . 목록 항목을 클릭하면 페이지의 컨트롤에 Label 메시지가 표시됩니다. 글머리 기호 목록의 모든 링크 단추는 동일한 Click 이벤트를 발생합니다. 이벤트를 발생시킨 링크 단추를 확인하기 위해 인수를 BulletedListEventArgs 검사합니다.
<%@ 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 클릭할 때 이벤트가 발생합니다. 컨트롤의 BulletedList 목록 항목을 사용하여 이벤트를 DisplayMode 발생 Click 하려면 먼저 속성을 값LinkButton으로 설정해야 합니다.
이벤트를 발생시키는 경우 대리자를 통해 이벤트 처리기가 호출됩니다. 이벤트를 처리하는 방법에 대한 자세한 내용은 이벤트 처리 및 발생을 참조하세요.