Telerik Extensions for ASP.NET MVC

The component renders fine, but its client-side features do not work

The most common reason is that there is no ScriptRegistrar or it is placed before the UI components. It is mandatory that you add a ScriptRegistrar because the UI components require it to output their client-side objects and JavaScript files. A typical location is at the end of your master page (~/Views/Shared/Site.master by default). All you need to do is add the following line at the end of your master page (or view page for that matter):
CopyMinimal ScriptRegistrar declaration
<%= Html.Telerik().ScriptRegistrar() %>
For additional info check Using Telerik Extensions for ASP.NET MVC in your project.

Compilation error: Invalid expression term ')'

The most common reason for this problem is using templates with <%= ... %> server expressions. Templates require <% ... %> (without the '=') and you must call the Render method.

WrongRight
CopyIncorrect template declaration
<%= Html.Telerik().Window() //<-- using '<%=' instead of '<%'
        .Name("Window")
        .Content(() => 
        {
           %> 
              <strong>Hello World!!!</strong>
           <%
        }) //<-- not calling Render()
%>
CopyCorrect template declaration
<% Html.Telerik().Window() //<-- using '<%'
       .Name("Window")
       .Content(() => 
        {
           %> 
              <strong>Hello World!!!</strong>
           <%
        })
       .Render(); //<-- calling Render() (note the semi-colon ';')
%>

Client-side features do not work in partial views loaded on demand by TabStrip, PanelBar or custom code

Important
This issue was addressed with the Q2 2011 release of Telerik Extensions for ASP.NET MVC. The workaround mentioned below is no longer required.

Any UI component defined in a partial view which is later loaded using Ajax, will not be able to register its required JavaScript files. As a result, the client-side features of the component will not work.

The workaround is to manually register the JavaScript files needed by any UI component defined in a partial view and loaded on demand. Check the Required JavaScript files help topic to see what JavaScript are required by each UI component.

Here is how to manually register the JavaScript files for the grid (this should be put in the master page or the view where the TabStrip or Panelbar resides):

CopyManually registering the grid JavaScript files
<%= Html.Telerik().ScriptRegistrar().DefaultGroup(group => 
     {
          group.Add("telerik.common.js");         // That file is always required
          group.Add("telerik.grid.js");
          group.Add("telerik.grid.filtering.js"); // Include only if filtering is enabled
          group.Add("telerik.grid.grouping.js");  // Include only if grouping is enabled
          group.Add("telerik.grid.editing.js");   // Include only if editing is enabled
     })
%>

The Using with partial views loaded via Ajax topic is a tutorial showing how to load a partial view using custom code.

The component is not styled

Make sure you have registered the common and skin CSS files. This could be done either by using <link> tags or via the StyleSheetRegistrar component:
CopyStyleSheetRegistrar theme declaration
<%= Html.Telerik().StyleSheetRegistrar()
        .DefaultGroup(group => group
              .Add("telerik.common.css")
              .Add("telerik.vista.css")
        )
%>
For additional info check Using Telerik Extensions for ASP.NET MVC in your project.

Compilation Error when binding navigation component.

The common exception, which the compiler throws is:
Possible solutions for this exception:
  • Check if the following line is present in your web.config:
    Copyweb.config
    <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
    or (For .NET 4.0)
    Copyweb.config
    <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
  • Check whether there is a compilation error in the Action method passed as parameter to the BindTo method. For instance, the following code will produce the aforementioned exception:
    CopyPart of binding configuration
    .BindTo(Model, mappings => 
    {
        mappings.For<Category>(binding => binding
                .ItemDataBound((item, category) =>
                {
                    //Wrong statement.
                    item.Text = category.WrongStatement;
                })
     ...

NotSupportedException: The "t-componentname-rtl" class is no longer supported

This exception is thrown if you are using the older way of enabling right-to-left mode. Check the Right-to-left Support help topic.

See Also