This is a migrated thread and some comments may be shown as answers.

(Rad)ScriptManager, MasterPage and Intellisense

9 Answers 235 Views
ScriptManager and StyleSheetManager
This is a migrated thread and some comments may be shown as answers.
Ubaldo
Top achievements
Rank 1
Ubaldo asked on 21 Jul 2011, 04:41 PM
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

9 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 28 Jul 2011, 11:20 AM
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.

0
Otto Neff
Top achievements
Rank 2
answered on 23 Nov 2011, 10:23 AM
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.,
0
Otto Neff
Top achievements
Rank 2
answered on 23 Nov 2011, 01:15 PM
Hi,

okay found a solution by myself....  See my blog post :-)
JavaScript Intellisense with Telerik in ASP.NET Master Page Project with VS 2010
0
Simon
Telerik team
answered on 29 Nov 2011, 12:42 PM
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
0
Abdullah
Top achievements
Rank 1
answered on 26 May 2012, 09:53 AM
does that problem fixed, i still can not access telerik javascript intellisense from content pages which are inherited from master page with RadScriptManager.
0
Genady Sergeev
Telerik team
answered on 31 May 2012, 09:34 AM
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.
0
Pic
Top achievements
Rank 1
answered on 22 Aug 2012, 04:49 PM
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>
...


0
Accepted
Otto Neff
Top achievements
Rank 2
answered on 23 Aug 2012, 08:01 AM
0
Christopher Blickley
Top achievements
Rank 2
answered on 29 Nov 2012, 08:32 PM
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.
Tags
ScriptManager and StyleSheetManager
Asked by
Ubaldo
Top achievements
Rank 1
Answers by
Simon
Telerik team
Otto Neff
Top achievements
Rank 2
Abdullah
Top achievements
Rank 1
Genady Sergeev
Telerik team
Pic
Top achievements
Rank 1
Christopher Blickley
Top achievements
Rank 2
Share this question
or