IntelliSense for Client API
- 4 minutes to read
DevExpress ASP.NET Controls support IntelliSense for client-side API. This topic describes how to enable IntelliSense depending on the Visual Studio version.
Note
Reporting components ship without definition files for their client-side API members and do not fully support this functionality.
Visual Studio 2022
Add the devexpress-web.d.ts, sizzle.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 24.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, sizzle, and knockout packages are automatically installed with the target package.
Make sure that your application folder contains all files shown in the image below.
Add the following string to each script file (or script block) where you will use IntelliSense:
///<reference path="devexpress-web.d.ts" />
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.
Visual Studio 2019
Add the devexpress-web.d.ts, sizzle.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 24.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, sizzle, and knockout packages are automatically installed with the target package.
Make sure that your application folder contains all files shown in the image below.
For a Web Site project:
- Update the Solution Explorer in Visual Studio.
Add the following string to each script file (or script block) where you will use IntelliSense:
///<reference path="devexpress-web.d.ts" />
For a Web Application project:
- Wait until Visual Studio adds these definition files to the project.
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.
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 client controls, see the following instructions:
In Visual Studio, open Tools -> Options -> Text Editor -> JavaScript/TypeScript -> Language Service and check the Enable the new JavaScript language service checkbox.
Add the devexpress-web.d.ts, sizzle.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 24.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, sizzle, and knockout packages are automatically installed with the target package.
Make sure that your application folder contains all files shown in the image below.
For a Web Site project:
- Update the Solution Explorer in Visual Studio.
Add the following string to each script file (or script block) where you will use IntelliSense:
///<reference path="devexpress-web.d.ts" />
For a Web Application project:
- Wait until Visual Studio includes the definition files to the project.
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.
Visual Studio 2015
You can register the ASPxScriptIntelliSense.js file at the IDE level to activate JavaScript IntelliSense for all 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 Tools -> Options -> Text Editor -> JavaScript -> IntelliSense -> References;
- 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 24.2\Components\Sources\DevExpress.Web.ASPxScriptIntelliSense” path);
- Click OK to save changes.
You can now use Intellisense to browse available DevExpress ASP.NET client-side types.
How to Use the Cast Method
The Cast method allows you to indicate the type of a client-side control 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.
Convert a client object. Use the ClientInstanceName (or ID) property value to access the client object. For instance, if an ASPxGridView control’s ClientInstanceName property is set to ‘grid’, use the following code to cast the object: