Saturday, March 5, 2011

Menu control

 <asp:Menu ID="Menu1" runat="server" StaticDisplayLevels="3">  
  <Items>  
   <asp:MenuItem Text="File" Value="File">  
    <asp:MenuItem Text="New" Value="New"></asp:MenuItem>  
    <asp:MenuItem Text="Open" Value="Open"></asp:MenuItem>  
   </asp:MenuItem>  
   <asp:MenuItem Text="Edit" Value="Edit">  
    <asp:MenuItem Text="Copy" Value="Copy"></asp:MenuItem>  
    <asp:MenuItem Text="Paste" Value="Paste"></asp:MenuItem>  
   </asp:MenuItem>  
   <asp:MenuItem Text="View" Value="View">  
    <asp:MenuItem Text="Normal" Value="Normal"></asp:MenuItem>  
    <asp:MenuItem Text="Preview" Value="Preview"></asp:MenuItem>  
   </asp:MenuItem>  
  </Items>  
 </asp:Menu>  
This is a example of a Menu Control

For making a menu change its orientation you just need to change the Orientation property of the Menu control to Horizontal or Vertical.

The Menu control has two modes of display: static and dynamic. Static display means that the Menu control is fully expanded all the time. The entire structure is visible, and a user can click on any part. In a dynamically displayed menu, only the portions you specify are static, while their child menu items are displayed when the user holds the mouse pointer over the parent node.

Each menu level supports style properties. If no dynamic style properties are set, the static style properties are used. If dynamic style properties are set and no static style properties are set, the default rendering of static style properties is used. The Menu control style hierarchy is as follows:
  1. Control
  2. SubMenuStyles
  3. MenuItemStyles
  4. SelectedItemStyles
  5. HoverMenuItemStyles

No comments:

Post a Comment