Asp.net Menu control


Menu control can be used to navigate through pages that is used to create a menu of hierarchical data. In the menu control, there are two types of conceptually designed items that are the first StaticMenu which is always displayed on the page Is the second dynamic menu that appears when the original item opens.

Properties like back collar, foreclosure, border coral, border style, borderwidth, height etc are applied through the style of table, tr, td /> tag.

Following are some important properties that are very useful.'

Properties of Menu Control
DataSourceIDPoint to the data source to use (you can use the .sitemap file as the data source).
TextIndicates the text to display in the menu.
TooltipIndicates the tooltip of the menu item when you mouse over.
ValueIndicates the nondisplayed value (usually unique id to use in server side events)
NavigateUrlThe menu indicates the target location to send the user to when the item is clicked, if not set, then you can control the menu itamclick event.
TargetIf NavigationTool property is set, this indicates how to open the target location (in a new window or in the same window)
Selectabletrue/false. If false, this item can't be selected. Usually in case of this item has some child.
ImageUrlIndicates the image that appears next to the menu item.
ImageToolTipIndicates the tooltip text to display for image next to the item.
PopOutImageUrlInidcates the image that is displayed right to the menu item when it has some subitems.
TargetIf NavigationUrl property is set, it indicates where to open the target location (in new window or same window).
Styles of Menu Control
StaticMenuStyleSets the style of the parent box in which all menu items appears.
DynamicMenuStyleSets the style of the parent box in which dynamic menu items appears.
StaticMenuItemStyleSets the style of the individual static menu items.
DynamicMenuItemStyleSets the style of the individual dynamic menu items.
StaticSelectedStyleSets the style of the selected static items.
DynamicSelectedStyleSets the style of the selecdted dynamic items.
StaticHoverStyleSets the mouse hovering style of the static items.
DynamicHoverStyleSets the mouse hovering style of the dynamic items (subitems).


Example - 

// Menu Control ////////////////////////////          
<asp:Menu ID="Menu1" runat="Server" DataSourceID="SiteMapDataSource1"
         Orientation="Horizontal" BackColor="#B5C7DE" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284E98" StaticDisplayLevels="2" StaticSubMenuIndent="10px"
           >
            <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
            <DynamicHoverStyle BackColor="#284E98" ForeColor="White" />
            <DynamicMenuStyle BackColor="#B5C7DE" />
            <StaticSelectedStyle BackColor="#507CD1" />
            <DynamicSelectedStyle BackColor="#507CD1" />
            <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
            <StaticHoverStyle BackColor="#284E98" ForeColor="White" />
        </asp:Menu>       

// SiteMapDataSource Control ////////////////////////////
        <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="Server" />

Share on Google Plus

About It E Research

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment