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

Urgent: Migrat to Telerik in PartialView, Scripts/CSS not Rendering

1 Answer 49 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.
Paul
Top achievements
Rank 1
Paul asked on 21 Dec 2011, 08:45 PM
MVC UI Extensions V.2011.3.1115.340

Previously, everything was working.  The project was setup such that the _Layout contained the Style and Script registrars from Telerik.  This layout page was being referenced by a View which contained a Telerik grid.  Everything rendered without an issue.  Modified my View to Pass the model to a PartialView which contains the same structure and code as previously within the view.

The oddity is the telerik control on the subpage is infact rendering (in this case, a table, links, etc), however, the script registrar ignores those controls when rendering scripts and styles.  The page in fact renders without any styles or scripts. 

Per the Manual, I've tried both manual script registration (supposedly unnecessary under the version I am running) as well as addition
of handler in web.config (breaks pages) without posivite result. 

Any pages accessing the _Layout sees the correct content, yet my new view which relies on  @{Html.RenderPartial("DailyGrid", Model.Items);} no longer emits scripts  styles.

Any suggestions would be appreciated.


1 Answer, 1 is accepted

Sort by
0
Joe
Top achievements
Rank 1
answered on 22 Dec 2011, 12:20 AM
I had this problem as well, the telerik MVC script and css register would (seemingly randomly) not render the required <script> and javascript magic. Seems to be related to the Razor engine.

The advise in this thread fixed my problem.

In a nutshell: Remove the Render(); bit from the style and script register parts of your views:   

so try changing

@{Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.webblue.css")).Render();}
to
@(Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.webblue.css")))


and

@{Html.Telerik().ScriptRegistrar().Globalization(true).jQuery(false).Render()}
to
@(Html.Telerik().ScriptRegistrar().Globalization(true).jQuery(false))
Tags
General Discussions
Asked by
Paul
Top achievements
Rank 1
Answers by
Joe
Top achievements
Rank 1
Share this question
or