Source view of MENU.ASPX
DotNet Funda: Code Viewer
menu.aspx | menu.aspx.cs
Close Window  
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHeader" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderForTitleAndIntro" Runat="Server">
    <table width="100%" cellpadding="2" cellspacing="0">
        <tr valign="top" class="ArticleTitle">
            <td style="padding-left:10px;" valign="middle">
                asp:Menu control</td>
        </tr>
        <tr>
            <td class="ArticleContents">
                The Menu control is used to create a menu of hierarchical data that can be used to navigate through the pages.
            </td>
        </tr>
        <tr>
            <td colspan="2">&nbsp;</td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderForContents" Runat="Server">
    <div class="ArticleContents">
        The Menu control is used to create a menu of hierarchical data that can be used to navigate through the pages.
        The Menu control conceptually contains two types of items. First is StaticMenu that is always displayed on the page, Second is DynamicMenu that appears when opens the parent item.
        <p>
            Its properties like <span class="DemoCP">BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. </span>
            are implemented through style properites of &lt;table, tr, td/&gt; tag. 
        </p>
                
        Following are some important properties that are very useful.
        <table width="100%" class="TutoPropPlaceHolder" border="1" cellpadding="2" cellspacing="1">
            <tr>
                <th colspan="2" align="left">Properties of Menu Control</th>
            </tr>
            <tr>
                <td class="DemoCP">DataSourceID</td>
                <td>
                    Indicates the data source to be used (You can use .sitemap file as datasource).
                </td>
            </tr>
            <tr>
                <td class="DemoCP">Text</td>
                <td>
                    Indicates the text to display in the menu.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">Tooltip</td>
                <td>
                    Indicates the tooltip of the menu item when you mouse over.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">Value</td>
                <td>
                    Indicates the nondisplayed value (usually unique id to use in server side events)
                </td>
            </tr>
            <tr valign="top">
                <td class="DemoCP">NavigateUrl</td>
                <td>
                    Indicates the target location to send the user when menu item is clicked. If not set you can handle MenuItemClick event to decide what to do.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">Target</td>
                <td>
                    If <span class="DemoCP">NavigationUrl</span> property is set, it indicates where to open the target location (in new window or same window).
                </td>
            </tr>
            <tr>
                <td class="DemoCP">Selectable</td>
                <td>
                    true/false. If false, this item can't be selected. Usually in case of this item has some child.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">ImageUrl</td>
                <td>
                    Indicates the image that appears next to the menu item.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">ImageToolTip</td>
                <td>
                    Indicates the tooltip text to display for image next to the item.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">PopOutImageUrl</td>
                <td>
                    Inidcates the image that is displayed right to the menu item when it has some subitems.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">Target</td>
                <td>
                    If <span class="DemoCP">NavigationUrl</span> property is set, it indicates where to open the target location (in new window or same window).
                </td>
            </tr>
            
           <tr>
                <th colspan="2" align="left">Styles of Menu Control</th>
            </tr>
            <tr>
                <td class="DemoCP">StaticMenuStyle</td>
                <td>
                    Sets the style of the parent box in which all menu items appears.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">DynamicMenuStyle</td>
                <td>
                    Sets the style of the parent box in which dynamic menu items appears.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">StaticMenuItemStyle</td>
                <td>
                    Sets the style of the individual static menu items.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">DynamicMenuItemStyle</td>
                <td>
                    Sets the style of the individual dynamic menu items.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">StaticSelectedStyle</td>
                <td>
                    Sets the style of the selected static items.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">DynamicSelectedStyle</td>
                <td>
                    Sets the style of the selecdted dynamic items.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">StaticHoverStyle</td>
                <td>
                    Sets the mouse hovering style of the static items.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">DynamicHoverStyle</td>
                <td>
                    Sets the mouse hovering style of the dynamic items (subitems).
                </td>
            </tr>
            
        </table>
        <!-- START - Demo Section -->
        <table class="DemoPlaceHolder" border="1" cellpadding="2" cellspacing="4">
            <tr>
                <td class="DemoTitle">
                    DEMO : Menu
                </td>
                <td align="right">
                    <a class="DemoShowSource" href="../../misc/codeviewer/default.aspx?pagename=~/tutorials/controls/menu.aspx" target="_blank">Show Source Code</a>
                </td>
            </tr>
            <tr>
                <td>
                    
                    <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>
                    
                    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="Server" />
                                        
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <!-- START - Server Side Code -->
                    <pre>                    
// Menu Control ////////////////////////////          
&lt;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"
           &gt;
            &lt;StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" /&gt;
            &lt;DynamicHoverStyle BackColor="#284E98" ForeColor="White" /&gt;
            &lt;DynamicMenuStyle BackColor="#B5C7DE" /&gt;
            &lt;StaticSelectedStyle BackColor="#507CD1" /&gt;
            &lt;DynamicSelectedStyle BackColor="#507CD1" /&gt;
            &lt;DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" /&gt;
            &lt;StaticHoverStyle BackColor="#284E98" ForeColor="White" /&gt;
        &lt;/asp:Menu&gt;
        

// SiteMapDataSource Control ////////////////////////////
        &lt;asp:SiteMapDataSource ID="SiteMapDataSource1" runat="Server" /&gt;


                    </pre> 
                    <!-- END - Server Side Code -->
                </td>
            </tr>
        </table>
        <!-- END - Demo Section -->
        </div>
    <br />
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderFooter" Runat="Server">
</asp:Content>

Go Top