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

[Solved] Adding Editor to View Prevents JS/CSS from Being Streamed

3 Answers 14 Views
Editor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Robert
Top achievements
Rank 1
Robert asked on 02 Feb 2012, 09:28 PM
Hi all

I am playing about the MVC extensions and have the grid and datepickers working elsewhere, but have had less success with the editor.

If I include the editor on any page, it does not style. It is on the page, but as a list of unformatted, plain links as you can see here. A 'view source' shows that no JS or CSS files have streamed down to the page.

If I remove the editor, with no other changes, the page displays fine and the CSS/JS is streamed down with no problems.

Firstly, I am using ASP.NET MVC 3 and razor view engine. jQuery version is 1.5.1.

Partial View
@model TestViewModel
 
@Html.ValidationSummary(true)
@Html.EditorForModel("TestViewModel_Create")

EditorForModel renders the following:
@model TestViewModel
 
@{
    Html.Telerik().EditorFor(x => x.LongDescription)
                  .Name("TestEditor")
                  .Render();
}

Layout used for the partial view
<!DOCTYPE html>
<html>
<head>
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/somecss1.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/somecss2.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/jquery-ui-1.8.17.custom.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script>
    <script src="@Url.Content("/Scripts/MicrosoftMvcAjax.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/custom/somecustom.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
    @{
        Html.Telerik().StyleSheetRegistrar()
            .DefaultGroup(group => group
                .Add("telerik.common.css")
                .Add("telerik.default.css")
                .Add("telerik.metro.css"))
                .Render();
    }
</head>
<body>
    <div id="framecontent">
        <div class="innertube">
            <div id="navigation">
                 <p>Menu would go here!</p>
            </div>
        </div>
    </div>
    <div id="maincontent">
        <div class="innertube">
                @RenderBody()
        </div>
    </div>
    @{
        Html.Telerik()
            .ScriptRegistrar()
            .jQuery(false)
            .jQueryValidation(false)
            .DefaultGroup(group => group
               .Add("telerik.common.min.js")
               .Add("telerik.grid.min.js")
               .Add("telerik.editor.js")
               .Add("telerik.calendar.min.js")
               .Add("telerik.datepicker.min.js")
               .Add("telerik.grid.filtering.js")
               .UseTelerikContentDeliveryNetwork(true)).Render();
    }
</body>
</html>

Any ideas where I am going wrong?

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 03 Feb 2012, 09:16 AM
Hi,

 The supported version of jQuery is 1.6.4 and above. You are using an older version.

Greetings,
Atanas Korchev
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
0
Robert
Top achievements
Rank 1
answered on 03 Feb 2012, 07:12 PM
Hi

Thanks for taking the time to have a look at this.

I have am now using jQuery 1.7 with the same results - the telerik registrars seem not to be pulling down the script/css files.



Update: The grid renders if I place the call to the Telerik.Editor extension method directly on the view without using the Html.EditorFor call. Very odd. 

Although it doesn't look styled correctly to me as you can see here. Is that just the theme I am using or am I missing some styling somewhere?
0
Atanas Korchev
Telerik team
answered on 06 Feb 2012, 08:34 AM
Hello,

It looks as if there is some CSS conflict or some of the images failed to load. You could check with an HTTP sniffer tool (such as Fiddler or Firebug) whether there are any failed HTTP requests - CSS files or images. The other option is that there is some sort of CSS conflict between the theme and your web site CSS files.

Regards,
Atanas Korchev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Editor
Asked by
Robert
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Robert
Top achievements
Rank 1
Share this question
or