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

[Solved] Document Ready on Partials Loaded with JQuery

1 Answer 78 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
gm
Top achievements
Rank 1
gm asked on 06 Mar 2012, 03:25 PM
I am following the procedure outlined here to load partial views via JQuery:

http://www.telerik.com/help/aspnet-mvc/using-with-partial-views-loaded-via-ajax.html#jQueryAjax

and everything is working fine, but the one thing I need is the ability to perform some initialization after the Telerik controls are initialized.  As I understand it, the JQuery $(document).ready is too soon to work with Telerik controls.  I tried to use the Html.Telerik().ScriptRegistrar().OnDocumentReady() to call my initialization, but when I add that statement, previously working functionality starts to break.  I know my description is pretty vague at this point, but was wondering if someone can point me to properly perform initialization after a partial view is loaded view JQuery, and whether I should be using ScriptRegistrar in this scenario?

Thanks


1 Answer, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 08 Mar 2012, 10:37 PM
Hello Gregg,

Using the ScriptRegistrar OnDocumentReady method will not ensure that the objects are initialized when loading partial views via Ajax. You could use the OnLoad client-side event for each Control to make sure that their objects are created.
Another option is to add the necessary Telerik scrips for the Controls in the main view, so a callback won't be used, and place your initialization scripts after all components.  

Greetings,
Daniel
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
General Discussions
Asked by
gm
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or