Thursday, January 22, 2009

How to add Submenu with Item Template using MenuItemTemplate and SubMenuItemTemplate



Now, how do I add a Sub Item to my Main Menu's... check the below logic. Its fairly simple. So, I took the MainMenu on the Central Admin site and tweaked it little bit.

Open the Welcome.ascx file. I wouldnt recommend doing any modifications on this file because this is a 1 file location and all your sites underneath reflect the modifications you do. So, make a copy... name it as WelcomeNew.ascx file.

and Add these lines below... and see how it works for yourself.

<SharePoint:SubMenuTemplate ID="ID_NewMenuItem" runat="server"
MenuGroupId="100"
Sequence="100"
Text="New Item">
<SharePoint:MenuItemTemplate runat="server" ID="ID_SilverLight"
Text="SilverLight"
MenuGroupId="100" Sequence="100"
ClientOnClickNavigateUrl="http://www.silverlight.net"
/>
<SharePoint:MenuItemTemplate runat="server" ID="ID_SharePoint"
Text="SharePoint"
MenuGroupId="100" Sequence="100"
ClientOnClickNavigateUrl="http://msdn.microsoft.com/"
/>
</SharePoint:SubMenuTemplate>

No comments: