Visual Studio JavaScript intellisense with Rad controls

7 posts, 1 answers
  1. Ashraf Sabry
    Ashraf Sabry avatar
    88 posts
    Member since:
    Jan 2011

    Posted 12 Dec 2013 Link to this post

    Greetings,

    I'm doing heavy client side work with Rad controls, specially the grid. I became tired from copying and pasting functions names from the console and hoped that Visual Studio intellisense would help me.
    I tried adding the Telerik.Web.UI.Common.Core.js file downloaded from the CDN to my Visual Studio references but intellisense broke.

    Does Telerik have a vsdoc (or any other format) definitions file for the library that can be referenced from VS to ease client side development?
  2. Ashraf Sabry
    Ashraf Sabry avatar
    88 posts
    Member since:
    Jan 2011

    Posted 12 Dec 2013 Link to this post

    I followed the instructions here and intellisense worked, but not complete and inconsistent.

    For example, the auto complete list doesn't provide the get_batchEditingManager member of the grid. Intellisense doesn't recognize Telerik.Web.UI.GridBatchEditing altogether.

    I have a variable annotated like this:
    /// <var type="Telerik.Web.UI.RadGrid"></var>
    var grid = $find("ctl00_ctl00_ContentPlaceHolder1_master_FormView1_Items_RadGrid1"),
    When I display the auto complete list for this variable I get only a minimum set of members. When I display the auto complete list for this expression:
    $telerik.findGrid("")
    I get far more members, although get_batchEditingManager is still not among them.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Angel Petrov
    Admin
    Angel Petrov avatar
    1007 posts

    Posted 17 Dec 2013 Link to this post

    Hi Ashraf,

    Indeed your observations are correct. Currently there are some methods and properties which are not available in the intellisense. I have logged this as an improvement in our feedback portal and it will be reviewed by our developers. You can check the progress of this item from here.

    Regards,
    Angel Petrov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  5. Ashraf Sabry
    Ashraf Sabry avatar
    88 posts
    Member since:
    Jan 2011

    Posted 19 Dec 2013 Link to this post

    I don't know what happened. When I moved my scripts to a class library project, I found that Telerik intellisense stopped working.
    I registered the Telerik.Web.UI assembly in the GAC but this didn't solve the problem.

    I had to extract the script files from the assembly and store them on my disk for intellisense to work. Here's the contents of my _refernces.js file now:
    /// <reference path="jquery-2.0.3-vsdoc.js" />
    /// <reference path="globalize.js" />
    /// <reference path="knockout-3.0.0.debug.js" />
    /// <reference path="MicrosoftAjax.debug.js" />
     
    //#region Telerik
    /// <reference path="Telerik.Web.UI.Ajax.Ajax.js" />
    /// <reference path="Telerik.Web.UI.Common.Animation.AnimationScripts.js" />
    /// <reference path="Telerik.Web.UI.Common.Extensions.js" />
    /// <reference path="Telerik.Web.UI.Grid.RadGridScripts.js" />
    /// <reference path="Telerik.Web.UI.Grid.GridBatchEditingScripts.js" />
    /// <reference path="Telerik.Web.UI.Grid.GridCellSelection.js" />
    /// <reference path="Telerik.Web.UI.Grid.GridVirtualizationScripts.js" />
    /// <reference path="Telerik.Web.UI.SearchBox.RadSearchBoxScripts.js" />
    /// <reference path="Telerik.Web.UI.ToolTip.RadToolTipScripts.js" />
    /// <reference path="Telerik.Web.UI.Window.RadWindowManager.js" />
    /// <reference path="Telerik.Web.UI.Window.RadWindowScripts.js" />
    /// <reference path="Telerik.Web.UI.Common.Core-vsdoc.js" />
    //#endregion

    I hope this doesn't violate the terms of use.
  6. Jacques
    Jacques avatar
    135 posts
    Member since:
    Jun 2007

    Posted 25 Feb Link to this post

    I'm working in Sitefinity 8.x and trying to get intellisense working for external JS files. I've tried all the above examples as well as a number of other examples of other posts and none of it seems to work. 

    Does this still work if you use the "/// <reference approach" referencing the Telerik.Web.UI assembly in the bin folder of a Sitefinity project? 

  7. Jacques
    Jacques avatar
    135 posts
    Member since:
    Jun 2007

    Posted 25 Feb in reply to Jacques Link to this post

    PS. I've added: 

    /// <autosync enabled="false" />
    /// <reference name="MicrosoftAjax.js"/>
    /// <reference path="modernizr-2.6.2.js" />
    /// <reference path="jquery-1.10.2.js" />
    /// <reference path="../js/kendo.all.min.js" />
    /// <reference path="bootstrap.js" />
    /// <reference path="custom-code.js" />

    To the _references.js file and the intellisense for each of those files works. 

    I added the following: 

    ///<reference name="Telerik.Web.UI.Common.Core.js" assembly="Telerik.Web.UI"/>

    To both the individual JS files and tried it in the _reference.js file, but no $telerik. 

    I tried this one too: 

    /// <reference path="Telerik.Web.UI.Common.Core-vsdoc.js" />

    Nothing! 

    Any help would be great. 

  8. Ashraf Sabry
    Ashraf Sabry avatar
    88 posts
    Member since:
    Jan 2011

    Posted 25 Feb in reply to Jacques Link to this post

    Jacques, you have to extract the js files from the assembly using a reflector like JustDecompile. Place them in a folder beside the _references.js. Make all paths in _references.js absolute. For example, if you placed your files in d:\intellisense a reference will be like this:

    /// <reference name="d:\intellisense\MicrosoftAjax.js"/>

    I don't know why VS get choked when the paths are relative to _references.js. This could be a bug.

    When diagnosing such issues, keep the VS output panel open and select the "JavaScript Language Service" output. If there're problems, error messages will be displayed there.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017