Description:
This article demonstrates how to add the ASPxNavBar control onto the default master page of a SharePoint 2010 application. It also describes the process of integrating DevExpress controls into SharePoint 2010.
Answer:
The entire process of modifying the QuickLaunch menu, or adding navigation controls to SharePoint 2010 can be split into the following parts:
Registering the ASPxNavBar control
Before controls become available in SharePoint, they should be registered on the system. To perform a proper registration, you should get DevExpress assemblies from the following directory:
*c:\Program Files (x86)\DevExpress 2010.1\Components\Components\Sources\DevExpress.DLL*
Your path might differ from the one mentioned above. It is not required to install DevExpress controls on the SharePoint server. For example, they can be already installed on the development machine, and can be taken from assemblies installed on the machine. Since navigation controls belong to the ASPxperience Suite, a list of required assemblies is the following (ASPxperience - Deployment):
DevExpress.Web.v10.1.dll
DevExpress.Data.v10.1.dll
DevExpress.Web.ASPxThemes.v10.1.dll
There are several ways to register the assemblies in the GAC: Adding Assemblies to the Global Assembly Cache.
Below are two pictures of the c:\Windows\assembly directory (before and after registering the assemblies):
Since the assemblies are registered in the GAC, they can be used by any web application. However, they should be registered in the web.config file, as it is described in the How to integrate a DevExpress web control into a SharePoint page KB article.
In the test SharePoint 2010 server, the web.config file is available in the c:\inetpub\wwwroot\wss\VirtualDirectories\80 directory.
XML<SafeControls>
...
<SafeControl Assembly="DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxNavBar" TypeName="*" Safe="True" />
<SafeControl Assembly="DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TypeName="*" Safe="True" />
<SafeControl Assembly="DevExpress.Data.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Data" TypeName="*" Safe="True" />
</SafeControls>
XML<assemblies>
<add assembly="DevExpress.Data.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<add assembly="DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<add assembly="DevExpress.Web.ASPxThemes.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
</assemblies>
Note: The ASPxThemes.dll assembly should be registered in the web.config file if it will use DevExpress themes on SharePoint pages.
The recent version of DevExpress controls uses the HTTP Module and HTTP Handler called the ASPxHttpHandlerModule, which should be registered in the web.config file assuming that SharePoint 2010 uses the IIE 7 application pool in Integrated Mode: How to manually register a HttpHandler Module.
XML<system.web>
<httpHandlers>
<add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule" verb="GET" path="DX.ashx" preCondition="integratedMode"/>
</httpHandlers>
<httpModules>
<add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
</httpModules>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
</modules>
<handlers>
<add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule" verb="GET" path="DX.ashx" preCondition="integratedMode"/>
</handlers>
</system.webServer>
Note: it will not be out of place to restart the IIS using the iisreset program, and then check the SharePoint web page, so the server starts normally.
Now everything is set up, so we can start placing DevExpress controls onto a page.
Modifying the master page's Quick Launch markup
The default master page of SharePoint 2010 can be modified using the SharePoint 2010 Designer. The designer can be downloaded from the following links:
Microsoft SharePoint Designer 2010 (32-bit)
Microsoft SharePoint Designer 2010 (64-bit)
To open SharePoint 2010, you should launch the Designer and then open a web site. The name of the web site should be a real name, which users can use, because if the localhost is specified, it will be impossible to edit master pages.
These steps are shown in an image below:
The current SharePoint application uses the v4.master page as a master page.
To add navigation controls onto the master page, they should be registered at the top of the file via the following line:
ASPx<%@ Register assembly="DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxNavBar" TagPrefix="dx" %>
In the middle of the v4.master page, you should locate the following code:
ASPx<SharePoint:UIVersionedContent UIVersion="4" runat="server">
<ContentTemplate>
<SharePoint:AspMenu id="V4QuickLaunchMenu" runat="server" EnableViewState="false" DataSourceId="QuickLaunchSiteMap" UseSimpleRendering="true" UseSeparateCss="false" Orientation="Vertical" StaticDisplayLevels="2" MaximumDynamicDisplayLevels="0" SkipLinkText="" CssClass="s4-ql" />
</ContentTemplate>
</SharePoint:UIVersionedContent>
You should remove the AspMenu and replace it with the ASPxNavBar:
ASPx<SharePoint:UIVersionedContent UIVersion="4" runat="server">
<ContentTemplate>
<dx:ASPxNavBar id="V4QuickLaunchNavBar" runat="server" DataSourceID="QuickLaunchSiteMap" EnableViewState="false" />
</ContentTemplate>
</SharePoint:UIVersionedContent>
Note: it is better to remove the AspMenu from the page, because if you comment it, some client-side initialization scripts will be rendered on the page, and they will try to use menu elements even if the menu is commented. An interesting fact is that the commented AspMenu is rendered on the page while it is enclosed in comment tags (<!-- and -->).
After performing these operations, you should see the ASPxNavBar control as a replacement of the QuickLaunch menu:
See Also:
KB article: Replacing a SharePoint master page's default Quick Launch menu with the ASPxNavBar