|
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
|
Tradução
Original
|
Classe MenuItemBindingCollection
System.Web.UI.StateManagedCollection
System.Web.UI.WebControls.MenuItemBindingCollection
Namespace: System.Web.UI.WebControls
Assembly: System.Web (em System.Web.dll)
O tipo MenuItemBindingCollection expõe os membros a seguir.
| Nome | Descrição | |
|---|---|---|
![]() | Count | |
![]() | Item |
| Nome | Descrição | |
|---|---|---|
![]() | Add | |
![]() | Clear | |
![]() | Contains | |
![]() | CopyTo(Array, Int32) | |
![]() | CopyTo(MenuItemBinding[], Int32) | |
![]() | Equals(Object) | |
![]() | GetEnumerator | |
![]() | GetHashCode | |
![]() | GetType | |
![]() | IndexOf | |
![]() | Insert | |
![]() | Remove | |
![]() | RemoveAt | |
![]() | SetDirty | |
![]() | ToString |
| Nome | Descrição | |
|---|---|---|
![]() ![]() | ICollection.Count | Infraestrutura. |
![]() ![]() | ICollection.IsSynchronized | Infraestrutura. |
![]() ![]() | ICollection.SyncRoot | Infraestrutura. |
![]() ![]() | IEnumerable.GetEnumerator | Infraestrutura. |
![]() ![]() | IList.Add | |
![]() ![]() | IList.Clear | Infraestrutura. |
![]() ![]() | IList.Contains | |
![]() ![]() | IList.IndexOf | |
![]() ![]() | IList.Insert | |
![]() ![]() | IList.IsFixedSize | Infraestrutura. |
![]() ![]() | IList.IsReadOnly | Infraestrutura. |
![]() ![]() | IList.Item | Infraestrutura. |
![]() ![]() | IList.Remove | |
![]() ![]() | IList.RemoveAt | |
![]() ![]() | IStateManager.IsTrackingViewState | |
![]() ![]() | IStateManager.LoadViewState | |
![]() ![]() | IStateManager.SaveViewState | |
![]() ![]() | IStateManager.TrackViewState |
Observação |
|---|
Uso o Item indexador para recuperar diretamente a MenuItemBinding o objeto em um índice com base zero específico. Use o GetEnumerator método para criar um enumerador que pode ser usado para iterar na coleção. Use o CopyTo método para copiar o conteúdo da coleção em uma matriz.
| Topic | Location |
|---|---|
| Demonstra Passo a passo: Controlando menus do ASP.NET de forma programática | dv_vwdcon |
| Demonstra Passo a passo: Exibir um menu em páginas da Web | dv_vwdcon |
| Demonstra Passo a passo: Controlando menus do ASP.NET por programação | Building ASP .NET Web Applications in Visual Studio |
| Passo a passo: controlando menus do ASP.NET por programação | dv_vwdcon |
| Passo a passo: exibindo um menu em páginas da Web | dv_vwdcon |
<%@ 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>Menu DataBindings Example</title> </head> <body> <form id="form1" runat="server"> <h3>Menu DataBindings Example</h3> <asp:menu id="NavigationMenu" staticdisplaylevels="1" staticsubmenuindent="10" orientation="Vertical" target="_blank" datasourceid="MenuSource" runat="server"> <DataBindings> <asp:menuitembinding datamember="MapHomeNode" depth="0" textfield="title" navigateurlfield="url"/> <asp:menuitembinding datamember="MapNode" depth="1" textfield="title" navigateurlfield="url"/> <asp:menuitembinding datamember="MapNode" depth="2" textfield="title" navigateurlfield="url"/> </DataBindings> </asp:menu> <asp:XmlDataSource id="MenuSource" datafile="Map.xml" runat="server"/> </form> </body> </html>
<%@ 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 Page_Load(Object sender, EventArgs e) { if(!IsPostBack) { // Create the menu item bindings for the Menu control. MenuItemBinding binding; binding = CreateMenuItemBinding("MapHomeNode", 0, "title", "url"); NavigationMenu.DataBindings.Add(binding); binding = CreateMenuItemBinding("MapNode", 1, "title", "url"); NavigationMenu.DataBindings.Add(binding); binding = CreateMenuItemBinding("MapNode", 2, "title", "url"); NavigationMenu.DataBindings.Add(binding); } } // This is a helper method to create a MenuItemBinding // object from the specified parameters. MenuItemBinding CreateMenuItemBinding(String dataMember, int depth, String textField, String navigateUrlField) { // Create a new MenuItemBinding object. MenuItemBinding binding = new MenuItemBinding(); // Set the properties of the MenuItemBinding object. binding.DataMember = dataMember; binding.Depth = depth; binding.TextField = textField; binding.NavigateUrlField = navigateUrlField; return binding; } </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>MenuItemBindingCollection Add Example</title> </head> <body> <form id="form1" runat="server"> <h3>MenuItemBindingCollection Add Example</h3> <asp:menu id="NavigationMenu" staticdisplaylevels="2" staticsubmenuindent="10" orientation="Vertical" target="_blank" datasourceid="MenuSource" runat="server"> </asp:menu> <asp:xmldatasource id="MenuSource" datafile="Map.xml" runat="server"/> </form> </body> </html>
<MapHomeNode url="~\Home.aspx"
title="Home"
description="Home">
<MapNode url="~\Music.aspx"
title="Music"
description="Music">
<MapNode url="~\Classical.aspx"
title="Classical"
description="Classical"/>
<MapNode url="~\Rock.aspx"
title="Rock"
description="Rock"/>
<MapNode url="~\Jazz.aspx"
title="Jazz"
description="Jazz"/>
</MapNode>
<MapNode url="~\Movies.aspx"
title="Movies"
description="Movies">
<MapNode url="~\Action.aspx"
title="Action"
description="Action"/>
<MapNode url="~\Drama.aspx"
title="Drama"
description="Drama"/>
<MapNode url="~\Musical.aspx"
title="Musical"
description="Musical"/>
</MapNode>
</MapHomeNode>
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Função Server Core sem suporte), Windows Server 2008 R2 (Função Server Core com suporte com o SP1 ou posterior, Itanium sem suporte)
O .NET Framework não oferece suporte a todas as versões de cada plataforma. Para obter uma lista das versões com suporte, consulte .Requisitos de sistema do NET Framework.

