Skip to main content

IntelliSense for Client API

  • 3 minutes to read

DevExpress ASP.NET MVC Extensions support IntelliSense for client-side API.

Refer to the applicable section of this topic (based on Visual Studio version) to enable IntelliSense.

Visual Studio 2019 or Later

  1. Add the devexpress-web.d.ts, jquery.d.ts, and knockout.d.ts definition files to the project folder. The last two files contain devexpress-web.d.ts file dependencies.

    You can obtain these files from the following sources:

    • In the C:\Program Files\DevExpress 23.2\Components\Sources\DevExpress.Web.ASPxScriptIntelliSense path of your installation.
    • From the npm package.

      Execute the command below in the npm CLI to install the package.

      npm install @types/devexpress-web

      jquery and knockout packages are automatically installed with the target package.

    Note

    The current “jquery.d.ts” version is only compatible with TypeScript 2.8.

  2. Wait until Visual Studio adds these definition files to the project. Make sure that your application folder contains all files shown in the image below.

    ASP.NET - TypeScript - SolutionExplorer

  3. Call a specific DevExpress client object’s Cast method to enable IntelliSense. For example, for the ASPxClientButton control, call the ASPxClientButton.Cast method.

You can now use IntelliSense to browse available DevExpress ASP.NET client-side API.

ASP.NET - TypeScript - IntelliSense

Visual Studio 2017

Visual Studio 2017 includes improved JavaScript IntelliSense support for .d.ts files (TypeScript definition files).

To enable IntelliSense for DevExpress ASP.NET Extensions’ client API, see the following instructions:

  1. In Visual Studio, open ToolsOptionsText EditorJavaScript/TypeScriptLanguage Service and check the Enable the new JavaScript language service checkbox.

    ASP.NET - TypeScript - VS2017Settings

  2. Add the devexpress-web.d.ts, jquery.d.ts, and knockout.d.ts definition files to your project folder. The last two files contain devexpress-web.d.ts file dependencies.

    You can obtain these files from the following sources:

    • From the C:\Program Files\DevExpress 23.2\Components\Sources\DevExpress.Web.ASPxScriptIntelliSense path of your installation.
    • From the npm package.

      Execute the command below in the npm CLI to install the package.

      npm install \@types/devexpress-web

      jquery and knockout packages are automatically installed with the target package.

    Note

    The current “jquery.d.ts” version is only compatible with TypeScript 2.8.

  3. Wait until Visual Studio includes the definition files to the project. Make sure that your application folder contains all files shown in the image below.

    ASP.NET - TypeScript - SolutionExplorer

  4. Call a specific DevExpress client object’s Cast method to enable IntelliSense. For example, for the ASPxClientButton control, call the ASPxClientButton.Cast method.

You can now use IntelliSense to browse available DevExpress ASP.NET client-side API.

ASP.NET - TypeScript - IntelliSense

Visual Studio 2015

You can register the ASPxScriptIntelliSense.js file at the IDE level to activate JavaScript IntelliSense for all DevExpress web projects.

Note

The ASPxScriptIntelliSense.js file is available if you install DevExpress products with source code.

Follow the steps below to register the ASPxScriptIntelliSense.js file:

  • In Visual Studio, select ToolsOptionsText EditorJavaScriptIntelliSenseReferences;
  • In the invoked dialog, choose the Implicit (Web) item in the Reference Group combo box;
  • Click the ellipsis (“…”) button next to the Add a reference to current group text box;
  • Select the ASPxScriptIntelliSense.js file (usually located in the “C:\Program Files\DevExpress 23.2\Components\Sources\DevExpress.Web.ASPxScriptIntelliSense” path);
  • Click OK to save changes.

    IntelliSenseForJS_VS2015_Options

  • Call a specific DevExpress client object’s Cast method to enable IntelliSense. For example, for the ASPxClientButton control, call the ASPxClientButton.Cast method.

You can now use Intellisense to browse available DevExpress ASP.NET client-side types.

IntelliSenseForJS_VS2015

How to Use the Cast Method

The Cast method allows you to indicate the type of an extension’s client-side object instance, which enables IntelliSense for this type.

You can use this method in the following ways.

  • Convert the event source object passed to a client event handler.

    IntelliSenseForJS-Cast1.png

  • Convert a client object. Use an extension’s Name property value to access the client object. For instance, if an GridView extension’s Name property is set to ‘grid’, use the following code to cast the object:

    IntelliSenseForJS-Cast2.png