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

[Solved] Loading an MVC Grid via jQuery load()

1 Answer 127 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Laurent Fabre
Top achievements
Rank 2
Laurent Fabre asked on 20 Dec 2009, 03:03 AM
Hi,

I must be doing something wrong but I keep getting this error "$.telerik.formatString is not a function" as soon as I use the grid reload button or any other grid function.

The grid is ajax bound contained in a .ascx which is loaded from a webpage (no masterpage) via $("#mydiv).load(myroute).

All the handlers are ok (taken from the examples web.config). The ScriptRegistrar is included right before the end of the body tag.

I tried including another ScriptRegistrar in the partial view with no luck. I keep moving things around see if it helps.

I do not use any other script on the page and firebug shows nothing but this error.

Right now I'm puzzled :)

I'm using Telerik Extensions for ASPNET MVC 2009 3 1103.

I did not try with the latest beta maybe I should.

Regards,

LF

1 Answer, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 21 Dec 2009, 08:08 AM
Hello Laurent,

Since the grid is dynamically loaded, the ScriptRegistrar has no way of knowing that it should register the grid scripts. You should register them manually, like this:

    <% Html.Telerik().ScriptRegistrar()
           .Scripts(scripts => scripts
               .Add("telerik.common.js")
               .Add("telerik.grid.js")
               .Add("telerik.grid.filtering.js")) /* if you are using filtering */
           .Render(); %>

Best wishes,
Alex
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Laurent Fabre
Top achievements
Rank 2
Answers by
Alex Gyoshev
Telerik team
Share this question
or