This article was translated by machine. To view in the article in English, select the English check box. You can also display the English text in a popup window by moving the mouse pointer over the text.
This documentation is archived and is not being maintained.

MenuItemCollection.GetEnumerator أسلوب

Visual Studio 2010

MenuItemCollection if the property indicates an ASP.NET version lower than ; otherwise, .

مساحة الاسم:  System.Web.UI.WebControls
التجميع:  System.Web (في System.Web.dll)

public IEnumerator GetEnumerator()

القيمة المُرجعة

النوع: System.Collections.IEnumerator
This property indicates how ASP.NET should render HTML for a control when the control is disabled.MenuItemCollection



If this property is GetEnumerator, ASP.NET renders a MenuItemCollection attribute when a control is disabled. Specifies the types of navigation UI that can be displayed for a step in a Current control. The navigation UI that is rendered for the step is determined automatically by the order in which the step is declared.MoveNext The step is the final data collection step.Reset


Reset Finish and Previous buttons are rendered for navigation.MoveNext Otherwهوe، العنصر يمثله Currentخاصية هو غير معرفة.

A CopyToNext button is rendered but a Previous button is not rendered for this step. The step is any step between the Start and the Finish steps.

The following code example demonstrates how to use the GetEnumerator method to create an enumerator that contains the submenu items of the Music menu item in a Menu control.

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<script runat="server">

  void Page_Load(Object sender, EventArgs e)

    // Display the submenu items of the Music
    // menu item. 

    // Retrieve the Music menu item.
    MenuItem musicMenuItem = NavigationMenu.FindItem(@"Home\Music");

    // Use the GetEnumerator method to create an enumerator 
    // that contains the submenu items of the Music menu item.
    IEnumerator menuItemEnumerator = musicMenuItem.ChildItems.GetEnumerator();

    Message.Text = "The submenu items of the Music menu item are: <br/><br/>";

    // Iterate though the enumerator to display the menu items.
    while (menuItemEnumerator.MoveNext())

      Message.Text += ((MenuItem)(menuItemEnumerator.Current)).Text + "<br />";




<html xmlns="" >
  <head runat="server">
    <title>MenuItemCollection GetEnumerator Example</title>
    <form id="form1" runat="server">

      <h3>MenuItemCollection GetEnumerator Example</h3>

      <asp:menu id="NavigationMenu"

          <asp:menuitem text="Home"
            <asp:menuitem text="Music"
              <asp:menuitem text="Classical"
              <asp:menuitem text="Rock"
              <asp:menuitem text="Jazz"
            <asp:menuitem text="Movies"
              <asp:menuitem text="Action"
              <asp:menuitem text="Drama"
              <asp:menuitem text="Musical"



      <asp:label id="Message" 


نظام التشغيل Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, الإصدار x64 من نظام التشغيل Windows XP Professional, Windows XP Starter Edition, Windows Server 2008, نظام التشغيل Windows Server 2003, نظام التشغيل Windows Server 2000 المزود بحزمة الخدمة SP4, نظام التشغيل Windows Millennium Edition, نظام التشغيل Windows 98

لا يدعم .NET Framework و .NET Compact Framework كافة الإصدارات الخاصة بكل نظام أساسي. للحصول على قائمة بالإصدارات المدعمة، راجع متطلبات النظام إطار عمل .NET.

.NET Framework

مدعوم في: 4, 3.5, 3.0, 2.0