Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Collapse]Common Concepts
  [Expand]Web.config Modifications
  [Expand]Callback Exception Handling
  [Expand]Client-Side Functionality
  [Expand]Cookies Support
  [Expand]Appearance Customization - Theming
   Icon Collection
  [Expand]Performance Optimization
  [Expand]CSS Image Sprites
   Supported Document Types
  [Expand]Accessibility Support
   Right to Left Support
   HTML Encoding
   Binary Storage Configuration
  [Collapse]SharePoint Support
   [Expand]Ready to Use Web Parts
   [Collapse]Developer Capabilities
     Installation and Deployment
     Upgrading to a Newer Version
     Visual Web Part Creation
     SharePoint Page Editing
     Web Part Creation
    SharePoint Troubleshooting Guide
   Mobile Support
  [Expand]Office Document Management
   Cloud Storage Account Management
  [Expand]Web Farm and Web Garden Support
 [Expand]ASP.NET WebForms Controls
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Web Part Creation

This topic describes how to use DevExpress ASP.NET controls in a standard Visual Studio Web Part project.

Expanded Requirements

  • In this tutorial, the following assemblies are used:

    • DevExpress.Data - the core DevExpress assembly;
    • DevExpress.Web - contains the main ASP.NET product code.

    The above assemblies should be registered in the GAC. If they have not yet been installed, install them into the GAC via the “gacutil” (the “C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\gacutil.exe” path for .NET v4) tool using the following commands.

    gacutil –i DevExpress.Data.v17.2.dll
    gacutil –i DevExpress.Web.v17.2.dll
  • Register the ASPxHttpHandlerModule module entry in the target SharePoint site Web.config (see the Developer Capabilities -> Installation and Deployment table for more information) - as demonstrated in the code below.

    • Registration for Version 14.2 and newer
    • Registration for Version 14.1 and older
  • Register the ASPxUploadProgressHttpHandler handler entry in the target SharePoint site Web.config (see the Developer Capabilities -> Installation and Deployment table for more information ) - as demonstrated in the code below.

    • Registration for Version 14.2 and newer
    • Registration for Version 14.1 and older
  • Mark each control/type from the DevExpress assemblies as safe to use. See the How to: Mark Controls as Safe Controls MSDN article for more information.

    Note that when you use a SharePoint-based project template (SharePoint Empty Project + Web Part Item), the entire assembly is marked as safe – as shown below.

    When using regular Class Library projects (for older SharePoint SDKs), it is necessary to mark all required types as safe.

    In this tutorial, the following namespaces are used.

    • DevExpress.Data;
    • DevExpress.Web;

    The code sample below demonstrates how to mark the required namespaces (for the ASPxCalendar in this tutorial) as safe.

Expanded Create a Web Part

  1. Create a new SharePoint Empty project and add the Web Part item to the project. See the How to: Create a SharePoint Web Part MSDN article for more information. Select the Deploy as a farm solution trust level.
  2. Add references to the required assemblies.
  3. Implement the CreateChildControls method and add the required control (for example, ASPxCalendar) to the Web Part Controls collection.
  4. Build and deploy the project to a target SharePoint site via the Deploy command.

  5. If the Deploy command is successfully completed, navigate to the required page and insert the deployed Web Part via the Site Actions -> Edit Page -> Insert -> Web Part command. By default, custom Web Parts are available in the Custom group.

The image below demonstrates the result.

Expanded See Also

Is this topic helpful?​​​​​​​