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

Partial View via Ajax and onload behavior

6 Answers 148 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.
jim
Top achievements
Rank 1
jim asked on 16 May 2011, 02:38 AM

I'm trying to figure out if I am using the telerik MVC controls the wrong way.

So, I've got a page, with all the telerik Javascript files being loaded by ScriptRegistrar.

On the page is a link, when clicked, makes an Ajax.ActionLink call and returns a partial view that gets put onto the page.

That Ajax.ActionLink is returning a telerik MVC control. But no matter which control I put in there, no actions on the control seems to register anything. I assume this is because the javascript bindings on the control get set up with the body onload, and the html/js returned by the ActionLink don't trigger an onload, so the controls never get initialized.

Is there a way to manually cause the telerik widgets to initialize?

6 Answers, 1 is accepted

Sort by
0
jim
Top achievements
Rank 1
answered on 16 May 2011, 02:48 AM
The title of this thread is wrong, I'm not making a direction partial view call, but a Ajax.ActionLInk call.
0
John DeVight
Top achievements
Rank 1
answered on 18 May 2011, 02:48 PM

There is a series of wiki pages that explain how to handle loading Partial Views containing Telerik controls on dynamically created tabs complete with sample code to download using the RAZOR View Engine or the ASPX View Engine:


Telerik MVC : Dynamically Add a Tab to the TabStrip

Telerik MVC : jQuery.ajax, Partial View and the Telerik Grid

Telerik MVC : jQuery.ajax, Partial View and Telerik Controls

Telerik MVC : Save Data From Telerik Controls Using jQuery.ajax

There is also a page that lists a series of wiki pages related to Telerik MVC at:

Telerik MVC Series

Please let me know if this solves your problem or if you need additional help!

Regards,

John DeVight
ASP.NET Wiki
Practical Solutions for ASP.NET Developers
http://aspnet.wikidot.com
0
Parker
Top achievements
Rank 1
answered on 18 May 2011, 08:45 PM
I asked a similar question here :
http://www.telerik.com/community/forums/aspnet-mvc/grid/how-to-load-grid-asynchronously-not-gridbuilder-databinding.aspx

I'm have a working version of the modified Telerik source that can create a JSON version of any Telerik Widget containing the html for the widget, the configuration of the widget, the type of the widget and the widget selector.  This is so that I do NOT need to eval dynamic scripts. The overhead of parsing the json version of the html is small considering that many modern browsers have fast native implementations.

I'll post a working version / diff to my original thread some time this week.
0
John DeVight
Top achievements
Rank 1
answered on 18 May 2011, 09:01 PM
That's a really cool idea!  I look forward to reading the post on your original thread...

Regards,

John DeVight
ASP.NET Wiki
Practical Solutions for ASP.NET Developers
http://aspnet.wikidot.com
0
jim
Top achievements
Rank 1
answered on 20 May 2011, 02:25 AM
Turns out I should have read http://www.telerik.com/help/aspnet-mvc/using-with-partial-views-loaded-via-ajax.html

Turns out I missed the whole thing related to OnSuccess.


0
Max
Top achievements
Rank 1
answered on 28 Nov 2011, 06:34 PM
hey there

Did you get an answer for your issue? I am having problems using Telerik controls with Ajax.ActionLink.
No matter what I do I always get jQuery undefined. I am using this on my Layout page:

@(Html.Telerik().ScriptRegistrar()
              .jQuery(false)
              .DefaultGroup(group => group
              .Add("telerik.common.js")
              .Add("telerik.component.js")
              .Add("~/Scripts/MicrosoftAjax.js")
              .Add("~/Scripts/MicrosoftMvcAjax.js")
              .Add("~/Scripts/jquery.unobtrusive-ajax.js")
              .Add("~/Scripts/jquery.validate.js")
              .Add("~/Scripts/jquery.validate.unobtrusive.js")                                                                                                      .Combined(true).Compress(true)
              )
)
Tags
General Discussions
Asked by
jim
Top achievements
Rank 1
Answers by
jim
Top achievements
Rank 1
John DeVight
Top achievements
Rank 1
Parker
Top achievements
Rank 1
Max
Top achievements
Rank 1
Share this question
or