Posts Tagged ‘asp.net’

Cheat Sheets

Wednesday, November 19th, 2008

» ASP.NET 2.0 Page Life Cycle & Common Events
» NET Format String Quick Reference
» Visual Studio 2005 Built-in Code Snippets (C#)
» ASP.NET Page Life Cycle Diagram
» ASP.NET Runtime Cheat Sheet
» Microsoft .NET Framework 3.5 Commonly Uses Types and Namespaces
» Visual Studio 2005 Default Keybindings C# | VB
» Visual Studio 2008 Default Keybindings C# | VB
» Microsoft ASP.NET AJAX Library
» Microsoft ASP.NET AJAX Client Life Cycle & Events
» LINQ
» VB.NET/C# Comparison
» SQL Server
» HTML Character Entities
» RGB Hex Color Chart
» CSS
» jQuery
» JavaScript
» XHTML
» Regular Expressions
» Microformats
» ASP/VBScript
» PHP
» Apache mod_rewrite Cheat Sheet (V2)
» Subversion Cheat Sheet

Rating: 5.0/10 (1 vote cast)

Programatically display SharePoint’s quick launch menu in C#

Thursday, May 1st, 2008

Using the SPNavigationNode you can quickly and simply pull out the quick launch menu from SharePoint. In this example we take the Menu and put it into an ArrayList.

Here is the function that we wrote.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
        public static ArrayList FetchMenuItems()
        {
            SPSite spsite = new SPSite("http://anws2");
            SPWeb site = spsite.OpenWeb();
            SPNavigationNodeCollection quickLaunchNodes = site.Navigation.QuickLaunch;
 
            int count = quickLaunchNodes.Count;
            ArrayList MenuItems = new ArrayList();
            foreach (SPNavigationNode node in quickLaunchNodes)
            {
                int ItemID = node.Id;
                int ParentID = node.ParentId;
                string ItemTitle = node.Title.ToString();
                string ItemUrl = node.Url.ToString();
                MenuItems.Add(new { Name =  ItemTitle, LinkUrl = ItemUrl });
            }
            return MenuItems;
        }

This was written to display the quick launch menu within the ASP.NET Outlook Accordion script written by Matt Berseth http://mattberseth.com/blog/2007/12/creating_an_outlook_navigation.html

Rating: 1.0/10 (1 vote cast)