Telerik UI for ASP.NET AJAX

Problem:

Error message “’Telerik’ is undefined” when running a website on Windows Vista IIS 7 Integrated mode.

Suggested Solution:

When in integrated mode, IIS7 reads the application configuration from the <system.webServer> section group in the application configuration file, but not the <system.web> section group. Since Visual Studio 2005 does not provide "native" support for IIS7, the RadScriptManager registration cannot be automatically added to the system.webServer.

To solve the problem you should manually add the HttpHandler registration to the system.webServer section group. There are two cases:

  • Telerik.Web.UI.dll is in the GAC:

    Copyweb.config
    <system.webServer><handlers><add name="Telerik.Web.UI.WebResource"  path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=[ASSEMBLY_VERSION], Culture=neutral, PublicKeyToken=121fae78165ba3d4" /></handlers>
    </system.webServer>
    Caution

    You need to replace [ASSEMBLY_VERSION] with the exact version of your DLL.

  • Telerik.Web.UI.dll is not in the GAC:

    Copyweb.config
    <system.webServer><handlers><add name="Telerik.Web.UI.WebResource"  path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" /></handlers>
    </system.webServer>

Additional information is available in this blog post: Web Resources demystified.

Problem:

Error message, "The type 'System.Web.UI.IScriptControl' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'"

Suggested Solution:

This error occurs when you have added a control from Telerik UI for ASP.NET AJAX but your application is not configured to use ASP.NET AJAX. To fix it, you need to follow the steps described at http://www.asp.net/ajax/documentation/live/ConfiguringASPNETAJAX.aspx (read the topic called Adding ASP.NET AJAX Configuration Elements to an Existing Web Site).

Problem:

Error message, "The control with ID '[ControlID]' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it."

Suggested Solution:

This error occurs when you have added a control from Telerik UI for ASP.NET AJAX to a page that does not contain a ScriptManager control. To resolve this error, please add a ScriptManager control to your page:

CopyASPX
<asp:ScriptManager ID="ScriptManager1" runat="server" />

If you are using master pages, you can add the ScriptManager control there. The ScriptManager control must precede all controls from the Telerik UI for ASP.NET AJAX suite. For further details about the ScriptManager control, you can read this article http://msdn.microsoft.com/en-us/library/bb398863(v=vs.100).aspx.

Problem:

Error message, "Microsoft JScript runtime error: 'Sys' is undefined"

Suggested Solution:

This error occurs when you have added a control from Telerik UI for ASP.NET AJAX but your application is not configured to use ASP.NET AJAX. To fix it, you need to follow the steps described at http://www.asp.net/ajax/documentation/live/ConfiguringASPNETAJAX.aspx (read the topic called Adding ASP.NET AJAX Configuration Elements to an Existing Web Site).

Another possible reason for this error (and the solution for it) is explained by the ASP.NET QA team here:

http://weblogs.asp.net/asptest/archive/2008/10/06/asp-net-ajax-and-http-handlers-a-cautionary-tale.aspx

Problem:

Telerik control stylesheet is not registered after an AJAX request (inside MS UpdatePanel) when the control is not initially visible on the page

Suggested Solution:

If the control is initially invisible and is shown after an ASP.NET AJAX update, you should manually register all the required CSS files in the head tag of your page. Otherwise, the control will not be displayed correctly. The easiest way to do this is through a LINK element:

CopyXML
<link href="<my_path_to_stylesheet>" rel="stylesheet" runat="server" >

Alternatively, replace the MS UpdatePanel with RadAjaxPanel or ajaxify the control via RadAjaxManager. Thus the stylesheet should be applied properly after an AJAX request even if the Telerik control is initially invisible.

Problem:

Using the Telerik controls with RadScriptManager on your login page throws one of the following errors:

  • ASP.NET Ajax client-side framework failed to load

  • 'Sys' is undefined

  • “Telerik.Web.UI” is undefined

Cause:

As the website denies access to all pages to unauthorized users, access to the Telerik.Web.UI.WebResource.axd handler is unauthorized. This causes the handler to serve the content of the login page instead of the combined scripts, hence the error.

Suggested Solution:

Add a <location> section to the application configuration file to allow access to Telerik.Web.UI.WebResource.axd to all users, like:

Copyweb.config
<configuration>
...
<location path="Telerik.Web.UI.WebResource.axd">
   <system.web>
     <authorization>
       <allow users="*"/>
     </authorization>
   </system.web>
 </location>
...
</configuration>

Problem:

Design-Time error on a page using Telerik controls:

Error Creating Control - Telerik control'Property' cannot be initialized. Details: Unable to cast object of type 'Type' to type 'Type'.

Cause:

If the Telerik.Web.UI.dll assembly is updated while a page using Telerik controls is in Design-time, VisualStudio creates two different versions of the assembly; hence two different versions of the same Telerik controls are available.

Suggested Solution:

Restart Visual Studio.

Problem:

When you drag a Telerik control from the Toolbox to the design surface, you get this error message:

Error creating control. Unable to cast object of type 'Telerik.Web.UI.Radxxx' to type 'Telerik.Web.UI.ControlItemContainer"

Suggested Solution:

Please check the following links for different solution options: link 1, link 2 and link 3.

Problem:

Setting ClientIDMode property to Static breaks the Telerik controls functionality

Suggested Solution:

Please note that using Static mode for Telerik controls is not supported. You should use AutoID mode for the Telerik controls on the page especially when they are performing AJAX requests. Microsoft recommends using ClientIDMode="Static" only for static controls. The Telerik controls, on the other hand, are controls with complex hierarchies of child controls and templates so setting their ClientID mode to static will break their functionality.

Problem:

Error message, “The Controls collection cannot be modified because the control contains code blocks".

Suggested Solution:

If you receive exceptions such as "System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks" you need to move the code block (i.e., <% ... %>) outside of the head tag:

Incorrect:

CopyASPX
<head id="Head1" runat="server">
  <script type="text/javascript">
  var grid = $find('<%= RadGrid1.ClientID %>');
  ...
  </script>
</head>
<body>
...
</body>

Correct:

CopyASPX
<head id="Head2" runat="server">
<telerik:RadCodeBlock id="RadCodeBlock1" runat="server">
   <script type="text/javascript">
       var grid = $find('<%= RadGrid1.ClientID %>');
       ...
   </script>
</telerik:RadCodeBlock>
</head>
<body>
...
</body>
or
<head id="Head3" runat="server">
</head>
<body>
   <telerik:RadCodeBlock id="RadCodeBlock1" runat="server">
   <script type="text/javascript">
       var grid = $find('<%= RadGrid1.ClientID %>');
       ...
   </script>
   </telerik:RadCodeBlock>
</body>

Problem:

System.IO.FileLoadException: Could not load file or assembly 'Telerik.Web.UI, Version=xxxx.x.xxx.xx, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Cause:

There is a reference to a version of Telerik.Web.UI in the web.config that is different from the version of the deployed assembly.

Suggested Solution:

Update the reference in the web.config to match the version of the deployed assembly.

Problem:

Telerik controls do not work if a Compression Module is used in the project/web site.

Cause:

Double compression of web resources: Web resources requested by the Telerik controls are compressed twice: once by the Script/RadScript/RadStyleSheet- Manager and once by the Compression Module.

Suggested Solution:

Skip compression for the requested resource in the Compression Module. If the OutputCompression property of RadScriptManager/RadStyleSheetManager is set to Disabled, you can configure the Compression Module to compress Telerik.Web.UI.WebResource.axd.

 

Control

Requested Resources

ScriptManager

WebResource.axd

ScriptResource.axd

RadScriptManager

Telerik.Web.UI.WebResource.axd

RadStyleSheetManager

Telerik.Web.UI.WebResource.axd

Problem:

Design-time error on a page using Telerik controls after upgrading to Q1 2009

Error creating control - ControlName

Failed to create designer "Telerik.Web.UI.ControlName..."

Cause:

Visual Studio 2008 has a problem with loading GAC-ed design-time assemblies of control libraries deployed in the Bin folder of a web site.

Suggested Solutions (select one of these):

  1. Install SP1 of Visual Studio 2008.

  2. Bin-deploy the design-time assembly

    • Add a reference to Telerik.Web.Design.dll to your web site or application

    • Remove Telerik.Web.Design.dll from the GAC

    • Restart Visual Studio

  3. GAC-deploy the control library assembly

    • Add Telerik.Web.UI.dll in the GAC

    • Remove Telerik.Web.UI.dll from your bin folder

    • Restart Visual Studio

  4. Copy Telerik.Web.UI.dll to C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies and restart Visual Studio.

Problem:

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission, please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException:Request for the permission of type 'System.Web.AspNetHostingPermission,...

Cause:

Microsoft changed the default setting of the Load User Profile setting of the application pools in Windows 7 and Windows 2008 (previously the setting was True, in IIS7.5 it is False).

Suggested Solution:

Open the Advanced Settings of the Application Pool and set the Load User Profile property to True.