We can add new link to Quick launch menu by two ways
i. By Site Setting
ii. By Programmatically
1. How to add new link by Site settings?
Follow the following steps:
a. Login by admin authentication
b. Goto Site Action -> Site Settings
c. Click on 'Quick Launch' under 'Look and Feel' section
d. Click on 'Select Heading' and add 'Web Address' where you want to redirect (I use '#' which redirects to default.aspx page)and then give new name for this new section in 'description' text box(I use 'Custom Menu').
e. Click on OK, this will create new section in Quick Launch menu
f. Then click on 'New Link', it will open new window
g. Provide web address, and description (I use '/MyCustomPage.aspx' and give name as 'My Custom Page', this name will displaying in Quick launch menu)
i. Then select heading from combo box, select 'Custom Menu' heading
j. click on OK button
k. Now click on Home or goto default.aspx page
2. How can we create Quick Launch menu Programmatically?
use following code:
SPWeb web = SPContext.Current.Site.RootWeb;
web.AllowUnsafeUpdates = true;
SPNavigationNodeCollection nodes = web.Navigation.QuickLaunch;
SPNavigationNode navNode = new SPNavigationNode("Custom Menu", "#", false);
nodes.AddAsFirst(navNode);
SPNavigationNode headerLink1 = new SPNavigationNode("My Custom Page", "/MyCustomPage.aspx", true);
nodes[0].Children.AddAsFirst(headerLink1);
This will create new section in Quick lauch menu..
Really soooo easy :)
Hello,
ReplyDeleteYou have got a nice blog- I have a question
regarding your "How can we create Quick Launch menu Programmatically?" Post.
You have given the code for creating Quick Launch menu.
Could you also please explain the implementation steps.
it would be really helpful for me.
Thanks again
Hii,
ReplyDeleteYou can insert this code anywhere as you want like you can insert this at feature receiver class if you want to create new quick launch link when your feature install or activated...
I'm new to WSS3.0 and MOSS2007
ReplyDeletestill don't digging on the platform.
If you can explain more, like I exactly don't know what or where the feature receiver class is!
Do I need to create a VS project ??
Thanks again
Hello SoftProgrammerr,
ReplyDeleteYou need to created VS project, and create new empty SharePoint project add add feature receiver class for this feature.
Check this link
or this also helps
or chat me on pune.nitin@gmail.com, i will help you in my free time.