JavaScript IntelliSense improvement in ASP.NET MVC Edition
We have added an improvement to JavaScript IntelliSense for our ASP.NET MVC controls. We have added a cast method to the client API that lets you use the client-side reference of ASP.NET MVC controls as typed objects.
This provides two major advantages:
- Code completion for properties/methods/events for respective control.
- The IntelliSense also shows summary for each API with rich examples
This feature is available starting with build:
- ASP.NET: 4.0.20172.131
- ASP.NET Core: 1.0.20172.131
Get the Update
- Download build from pre-release site.
- Extract the contents and update the binaries in installation folder: C:\Program Files (x86)\ComponentOne\ASP.NET MVC Edition\bin
- Copy and replace JsIntelliSense and TSTypings folders in installation folder with these: C:\Program Files (x86)\ComponentOne\ASP.NET MVC Edition
Referencing IntelliSense File
Visual Studio 2017
Follow the steps from documentation to import and reference type definition files. The new language service of VS2017 enables JavaScript IntelliSense with type definition file.
Visual Studio 2015 And Prior
Follow these one-time steps:
- Open Visual Studio
- Go to Tools -> Options
- Open TextEditor node.
- Expand JavaScipt node.
- Expand IntelliSense node, click References.
- Select “Implicit Web” under reference group.
- Add reference to C:\Program Files (x86)\ComponentOne\ASP.NET MVC Edition\JsIntellisense if it doesn’t already exist.
Using Cast Method
Let's compare the previous approach and the new cast method.
Previous getControl method
When using the getControl method of Control, the API didn't include much IntelliSense. For example, if we want to attach itemFormatter event to grid, we did not get much help with auto-completion or API information in the VS Code editor:
Now each class has a cast method:
var fg=wijmo.grid.FlexGrid.cast("#fg");
With this feature, we don't only get code completion; we also get rich information about the event within the code editor:
This immensely improves writing client-side scripts when using ASP.NET MVC controls and speeds up development.