MenuEventArgs.Item 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
발생한 이벤트와 연결된 메뉴 항목을 가져옵니다.
public:
property System::Web::UI::WebControls::MenuItem ^ Item { System::Web::UI::WebControls::MenuItem ^ get(); };
public System.Web.UI.WebControls.MenuItem Item { get; }
member this.Item : System.Web.UI.WebControls.MenuItem
Public ReadOnly Property Item As MenuItem
속성 값
발생한 이벤트와 연결된 메뉴 항목을 나타내는 A MenuItem 입니다.
예제
다음 코드 예제에서는 사용자가 클릭 하는 메뉴 항목의 속성에 액세스 하는 속성을 사용 Item 하는 방법을 보여 줍니다. 선택한 메뉴 항목의 텍스트가 페이지에 표시됩니다.
<%@ 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">
void MenuItemClick_NavigationMenu(Object sender, MenuEventArgs e)
{
// Display the text of the menu item selected by the user.
Message.Text = "You selected " + e.Item.Text + ".";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>MenuEventArgs Item Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>MenuEventArgs Item Example</h3>
<asp:menu id="NavigationMenu"
staticdisplaylevels="2"
staticsubmenuindent="10"
orientation="Vertical"
onmenuitemclick="MenuItemClick_NavigationMenu"
runat="server">
<items>
<asp:menuitem text="Home"
tooltip="Home">
<asp:menuitem text="Music"
tooltip="Music">
<asp:menuitem text="Classical"
tooltip="Classical"/>
<asp:menuitem text="Rock"
tooltip="Rock"/>
<asp:menuitem text="Jazz"
tooltip="Jazz"/>
</asp:menuitem>
<asp:menuitem text="Movies"
tooltip="Movies">
<asp:menuitem text="Action"
tooltip="Action"/>
<asp:menuitem text="Drama"
tooltip="Drama"/>
<asp:menuitem text="Musical"
tooltip="Musical"/>
</asp:menuitem>
</asp:menuitem>
</items>
</asp:menu>
<hr/>
<asp:label id="Message"
runat="server"/>
</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">
<script runat="server">
Sub MenuItemClick_NavigationMenu(ByVal sender As Object, ByVal e As MenuEventArgs)
' Display the text of the menu item selected by the user.
Message.Text = "You selected " & e.Item.Text & "."
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>MenuEventArgs Item Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>MenuEventArgs Item Example</h3>
<asp:menu id="NavigationMenu"
staticdisplaylevels="2"
staticsubmenuindent="10"
orientation="Vertical"
onmenuitemclick="MenuItemClick_NavigationMenu"
runat="server">
<items>
<asp:menuitem text="Home"
tooltip="Home">
<asp:menuitem text="Music"
tooltip="Music">
<asp:menuitem text="Classical"
tooltip="Classical"/>
<asp:menuitem text="Rock"
tooltip="Rock"/>
<asp:menuitem text="Jazz"
tooltip="Jazz"/>
</asp:menuitem>
<asp:menuitem text="Movies"
tooltip="Movies">
<asp:menuitem text="Action"
tooltip="Action"/>
<asp:menuitem text="Drama"
tooltip="Drama"/>
<asp:menuitem text="Musical"
tooltip="Musical"/>
</asp:menuitem>
</asp:menuitem>
</items>
</asp:menu>
<hr/>
<asp:label id="Message"
runat="server"/>
</form>
</body>
</html>
설명
이 Item 속성을 사용하여 발생한 이벤트와 연결된 메뉴 항목의 속성에 액세스하거나 수정할 수 있습니다. MenuItemClick 이벤트의 경우 이 항목은 사용자가 클릭한 메뉴 항목을 나타냅니다. MenuItemDataBound 이벤트의 경우 이 항목은 데이터에 바인딩되는 메뉴 항목을 나타냅니다.