Declare menu control in ASPX, ASCX files

You can define the menu control declaratively. First of all register control on page like this:

<%@ Register 
    TagPrefix="CodePlex" 
    Namespace="SPAdaptiveMenu.Controls" 
    Assembly="SPAdaptiveMenu, Version=1.1.0.0, Culture=neutral, PublicKeyToken=ccb6ce15f1e0dc48" %>


The following example shows the declarative markup for a Menu control:

<CodePlex:Menu runat="server" IconSize="Small" Id="SimpleMenu" Width="200px" Title="SPMenu small demo">
    <ItemCollection>
        <CodePlex:MenuNested Title="Microsoft SharePoint">
            <ItemCollection>
                <CodePlex:MenuOption Title = "Foundation" 
                    IconSrc = "/_layouts/images/icspdgeneric.gif"
                    OnClickText="alert('Microsoft SharePoint Foundation');" />
                <CodePlex:MenuOption Title = "Standart" 
                    IconSrc = "/_layouts/images/icspdgeneric.gif"
                    OnClickText="alert('Microsoft SharePoint Standart');" />
                <CodePlex:MenuOption Title = "Enterprise" 
                    IconSrc = "/_layouts/images/icspdgeneric.gif"
                    OnClickText="alert('Microsoft SharePoint Enterprise');" />
            </ItemCollection>
        </CodePlex:MenuNested>
        <CodePlex:MenuSeparator />
        <CodePlex:MenuCheck Title="Check Me!" />
        <CodePlex:MenuPostBack Title="PostBack Me!" 
            OnClick="OnCommandAction"
            CommandArgument="ClickArgument" />
        <CodePlex:MenuSeparator />
        <CodePlex:MenuLink Title="My blog"
            IconSrc="/_layouts/images/ichtm.gif"
            Url="http://blog.vitalyzhukov.ru" />
    </ItemCollection>
</CodePlex:Menu>


The result on a page is this:





Last edited May 30, 2012 at 5:36 AM by VitalyZhukov, version 4

Comments

No comments yet.