(Rad)ScriptManager, MasterPage and Intellisense

10 posts, 1 answers
  1. Ubaldo
    Ubaldo avatar
    12 posts
    Member since:
    Dec 2010

    Posted 21 Jul 2011 Link to this post

    Hi there, I'm encountering some problems in using Intellisense for client code.
    My scenario is: OS=Vista, VS2008, Telerik.Web.UI version 2011.1.413.35

    web.config httpHandlers:
    <httpHandlers>
      <remove verb="*" path="*.asmx" />
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" />
      <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" />
      <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
      <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false" />
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
    </httpHandlers>

    I'm using Master Page, so I've placed a RadScriptManager in the MasterPage
    <body>
      <form id="form1" runat="server">
      <telerik:RadScriptManager ID="RadScriptManager1" runat="server" >
      </telerik:RadScriptManager>

    Now, if I insert a script block in the master page, I have Intellisense with all the ajax library standard functions, like $find.
    If I insert a script block in a content page, in intellisense I don't get the ajax library functions (just standard Javascript).
    Same behavior if a substitute RadScriptManager with MS ScriptManager.

    Then I've added the <scripts> section to the (Rad)ScriptManager, like this:
    <body>
      <form id="form1" runat="server">
      <asp:ScriptManager ID="ScriptManager1" runat="server">
        <Scripts>
          <asp:ScriptReference Name="Telerik.Web.UI" Assembly="Telerik.Web.UI.Common.Core.js" />
        </Scripts>
      </asp:ScriptManager>
     In this case I don't get ajax library functions in Intellisense nowere (master page or content page).
    The same if using RadScriptManager instead of MS ScriptManager.

    Which is the right way to work with client intellisense with VS2008 ?

    TIA
    Ubaldo
  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 28 Jul 2011 Link to this post

    Hello Ubaldo,

    Intellisense works only with the ASP.NET ScriptManager, so you will have to put it on your pages instead of RadScriptManager whenever you want Intellisense.

    With Master/Content pages, you have to put the SM wherever you want Intellisense, e.g. if you are in a Content page, put a SM there.

    Currently these are the two most important things to have in mind when using JavaScript Intellisense in Visual Studio.

    Below you can find more info:
    I hope this helps.

    Kind regards,
    Simon
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Otto Neff
    Otto Neff avatar
    36 posts
    Member since:
    Jul 2011

    Posted 23 Nov 2011 Link to this post

    Hi,

    right, but what about the "only one" Instance Problem of a ScriptManager? 

    Is there any workaround or trick to have the Main ScriptManger on the Master Page and "only VS2010 visible"  
    JScript Intellisense ScriptManager in the Content Page?

    Kind regards.,
  5. Otto Neff
    Otto Neff avatar
    36 posts
    Member since:
    Jul 2011

    Posted 23 Nov 2011 Link to this post

    Hi,

    okay found a solution by myself....  See my blog post :-)
    JavaScript Intellisense with Telerik in ASP.NET Master Page Project with VS 2010
  6. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 29 Nov 2011 Link to this post

    Hello one,

    Thank you for sharing your workaround with the community.

    Hopefully VS vNext will fix this so that no workaround is necessary.

    Greetings,
    Simon
    the Telerik team
    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 their blog feed now
  7. Abdullah
    Abdullah avatar
    11 posts
    Member since:
    Oct 2011

    Posted 26 May 2012 Link to this post

    does that problem fixed, i still can not access telerik javascript intellisense from content pages which are inherited from master page with RadScriptManager.
  8. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 31 May 2012 Link to this post

    Hello,

    It is not possible to fix the problem at all. Lets hope that the new Visual Studio will have better intellisense support for JavaScript. For now the only workaround is to have ScriptManager placed on the content page while developing.

    Greetings,
    Genady Sergeev
    the Telerik team
    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 their blog feed now.
  9. Pic
    Pic avatar
    8 posts
    Member since:
    Jan 2012

    Posted 22 Aug 2012 Link to this post

    Thanks One for that trick.

    I've extended that a little bit adding the 'PersistenceMode' which allow the control to be analysed by VS before you work on the design file and give you the intellisence.

    This is the class:

    Imports Telerik.Web.UI

    Namespace IntellisenseJavascript

        <PersistenceMode(PersistenceMode.InnerProperty)> _

        <ToolboxData("<{0}:IntelliJS runat=""server"" ID=""intelliJS"" />")> _

        Public Class IntelliJS

            Inherits RadScriptManager

     

            Protected Overrides Sub OnInit(e As System.EventArgs)

            End Sub

            Protected Overrides Sub OnPreRender(e As System.EventArgs)

            End Sub

            Protected Overrides Sub OnLoad(e As System.EventArgs)

            End Sub

            Protected Overrides Sub Render(writer As System.Web.UI.HtmlTextWriter)

            End Sub

            Public Overrides Sub RenderControl(writer As System.Web.UI.HtmlTextWriter)

            End Sub

     

            Public Sub New()

                Dim scr As UI.ScriptReference = New UI.ScriptReference("~/MyScriptFolder/MyScriptFile.js")

                Me.Scripts.Add(scr)

                scr = New UI.ScriptReference("~/MyScriptFolder/MySecondScriptFile.js")

                Me.Scripts.Add(scr)

            End Sub

        End Class

    End Namespace




    And this is what you need to place on your page to get the javascript intellisense:
    <VSFix:IntelliJS runat="server" ID="intelliJS" />

    Note that if you do that modification, you will have to rebuild your project to see the effect.


    For those who didn't see the message from One, you also need to add this in your web.config:
    <configuration>
      ...
      <system.web>
        ...
        <pages>
          ...
          <controls>
             ...
              <add tagPrefix="VSFix" namespace="YourProjectNameSpace.IntellisenseJavascript" assembly="YourProjectAssembly"/>
           </controls>
    </pages>
    ...


  10. Christopher Blickley
    Christopher Blickley avatar
    202 posts
    Member since:
    Jan 2004

    Posted 29 Nov 2012 Link to this post

    This is great work.  I implemented your solution, but replaces the .aspx file with the references with a .js file with the references as follows:
    /// <reference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
    /// <reference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
    /// <reference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
    /// <reference path="Common/Scripts/MyScript1.js" />
    /// <reference path="Common/Scripts/MyScript2.js" />

    This eliminated the need for a .aspx file so I can just have a simple .js text file instead.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017