Skip to main content
A newer version of this page is available.

SharePoint Page Editing

  • 4 minutes to read

This section describes how to use the SharePoint Designer to embed DevExpress ASP.NET controls in a SharePoint Page.

Requirements

The following assemblies are used in this tutorial.

* **DevExpress.Data** - the core DevExpress assembly;
* **DevExpress.Web** - contains the main ASP.NET product code;
* **DevExpress.Web.ASPxThemes** - contains the skins and theme resources for DevExpress ASP.NET products.

These assemblies should be registered in the GAC. If they have not yet been registered, use the following commands in the “gacutil” tool (found in the “c:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\gacutil.exe” path for .NET v4) to deploy them.

``gacutil –i DevExpress.Data.v19.2.dll``

``gacutil –i DevExpress.Web.v19.2.dll``

``gacutil –i DevExpress.Web.ASPxThemes.v19.2.dll``
  • Register the ASPxHttpHandlerModule module entry in the target SharePoint site’s Web.config file - as demonstrated in the code sample below.

    • Registration for v14.2 and newer

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <configuration>
        ...
        <system.webServer>
          ...
          <modules runAllManagedModulesForAllRequests="true">
            ...
            <add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v19.2, Version=19.2.15.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule" />
          </modules>
        </system.webServer>
      </configuration>
      
    • Registration for v14.1 and older

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <configuration>
        ...
        <system.webServer>
          ...
          <modules runAllManagedModulesForAllRequests="true">
            ...
            <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v14.1, Version=14.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
          </modules>
        </system.webServer>
      </configuration>
      
  • Register the ASPxHttpHandlerModule module entry in the target SharePoint site’s Web.config file - as demonstrated in the code sample below.

    • Registration for v14.2 and newer

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <configuration>
        ...
        <system.webServer>
          ...
          <handlers>
              ...
              <add type="DevExpress.Web.ASPxUploadProgressHttpHandler, DevExpress.Web.v19.2, Version=19.2.15.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET,POST" path="ASPxUploadProgressHandlerPage.ashx" name="ASPxUploadProgressHandler" preCondition="integratedMode" />
           </handlers>
        </system.webServer>
      </configuration>
      
    • Registration for v14.1 and older

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <configuration>
        ...
        <system.webServer>
          ...
          <handlers>
              ...
              <add type="DevExpress.Web.ASPxUploadControl.ASPxUploadProgressHttpHandler, DevExpress.Web.v14.1, Version=14.1.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET,POST" path="ASPxUploadProgressHandlerPage.ashx" name="ASPxUploadProgressHandler" preCondition="integratedMode" />
           </handlers>
        </system.webServer>
      </configuration>
      
  • Mark each namespace/control from DevExpress assemblies to be used on the SharePoint Page as safe to use. (See the following MSDN article for more information: How to: Mark Controls as Safe Controls.) The code sample below demonstrates how to mark DevExpress controls as safe.

    <SafeControl Assembly="DevExpress.Data.v19.2, Version=19.2.15.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Data" TypeName="*" Safe="True" SafeAgainstScript="False" />
    <SafeControl Assembly="DevExpress.Web.v19.2, Version=19.2.15.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TypeName="*" Safe="True" SafeAgainstScript="False" />
    
  • Register DevExpress assemblies you wish to use in the corresponding Web.config section (as you do for a standard ASP.NET Web Application) – as shown in the following code example. See the following MSDN article to learn more: assemblies Element for compilation (ASP.NET Settings Schema).

    <assemblies>
        ...
        <add assembly="DevExpress.Data.v19.2, Version=19.2.15.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
        <add assembly="DevExpress.Web.v19.2, Version=19.2.15.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
        <add assembly="DevExpress.Web.ASPxThemes.v19.2, Version=19.2.15.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
    </assemblies>
    

Editing the SharePoint Page

This tutorial demonstrates how to replace the default QuickLaunch menu with ASPxNavBar.

  1. Open the SharePoint site in the SharePoint Designer.
  2. Edit the “seattle.master” Master Page in Advanced Mode.
  3. Add the following Register directive to the corresponding Master Page section.

    <%@ Register Assembly="DevExpress.Web.v19.2, Version=19.2.15.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>

  4. Define the ASPxNavBar control.

    <dx:ASPxNavBar ID="V4QuickLaunchMenu" runat="server" DataSourceID="QuickLaunchSiteMap" EnableViewState="false" Width="100%"></dx:ASPxNavBar>
    
  5. Since ASPxNavBar can be bound to a hierarchical datasource, you can use ASPxNavBar instead of the default QuickLaunchMenu.

    Sharepoint_Developer_PageEditing_DefaultNavBar

Applying Themes

DevExpress ASP.NET controls ship with 18 built-in skins. Set the ASPxNavBar.Theme property to “MetropolisBlue”, for example, to create an appearance that is consistent with the SharePoint 2013/Office 365 color scheme.

Sharepoint_Developer_PageEditing_MetroBlueNavBar

The following code sample defines the control’s Theme property.

<dx:ASPxNavBar ID="V4QuickLaunchMenu" runat="server" ... Theme="MetropolisBlue"></dx:ASPxNavBar>

You can specify a theme for an individual control or the entire application. See the following help topic for more information: DevExpress Themes Overview.

If you work with Sharepoint WebPart / VisualWebPart modules, override the CreateChildControls method to apply a theme.

public class WEB_PART_OR_VISUAL_WEB_PART_CLASS_HERE : WebPart {
    protected override void CreateChildControls() {
        DevExpress.Web.ASPxWebControl.GlobalTheme = "Aqua";
        ...
        //Create Child Controls Here
    }
}
See Also