Skip to main content

Visual Web Part Creation

  • 2 minutes to read

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

Requirements

  • Install all required DevExpress assemblies in the GAC. Refer to the following help topic for details: Installation and Deployment.
  • Register the ASPxHttpHandlerModule module entry in the target SharePoint site’s Web.config file.

    The code example below registers ASPxHttpHandlerModule.

    • 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.v22.2, Version=22.2.13.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 ASPxUploadProgressHttpHandler handler entry in the target SharePoint site’s Web.config file.

    The code example below registers ASPxUploadProgressHttpHandler.

    • 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.v22.2, Version=22.2.13.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET,POST" path="ASPxUploadProgressHandlerPage.ashx" name="ASPxUploadProgressHandler" preCondition="integratedMode" />
           </handlers>
        </system.webServer>
      </configuration>
      
    • Registration for 14.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>
      

Create a New Visual Web Part

  1. Create a new Visual Web Part project. (Refer to the following article for more information: How to: Create a SharePoint Visual Web Part). Select the Deploy as a farm solution trust level.

  2. Drag the required control (an ASPxButton in this example) from the Toolbox, and drop it onto a WebUserControl (the *.ascx file).

    Sharepoint_Developer_VisualWebPart_Designer

  3. Use the “Deploy” command to build the Visual Web Part and deploy it to the target SharePoint site.

    Sharepoint_Developer_VisualWebPart_Deploy

  4. Once deployment is complete, navigate to the required SharePoint page and use the Site ActionsEdit PageInsertWeb Part command to insert the deployed Visual Web Part. Custom Visual Web Parts are available in the Custom group by default.

The image below shows the result.

Sharepoint_Developer_VisualWebPart_Result

See Also