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

[Solved] ScriptManager and MVC Style Registrar

2 Answers 234 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.
Kaleem Khan
Top achievements
Rank 1
Kaleem Khan asked on 12 Nov 2009, 06:58 PM

i'm using a scriptManager and style sheet regitrat like this in my master page:

<telerik:RadScriptManager ID="RadScriptManagerMain" runat="server">

</telerik:RadScriptManager>

<% Html.Telerik().StyleSheetRegistrar()

.DefaultGroup(group => group.Add("telerik.common.css")

.Add("telerik.vista.css")).Render();

And I get the following exceptions:

{"Exception of type 'System.Web.HttpUnhandledException' was thrown."}
{"Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error."}



As soon as I remove style sheet registrar it works fine and I can use the web form control in MVC. Is this a conflict between ScriptManager and MVC style registrar.


 

 

2 Answers, 1 is accepted

Sort by
0
Yitzhak Khabinsky
Top achievements
Rank 1
answered on 12 Nov 2009, 08:47 PM
To follow best practices, just try to put the StyleSheetRegistrar()
inside the head HTML tag:

<head runat="server">
...
<% Html.Telerik().StyleSheetRegistrar()
    ...
    .Render();
%>
</head>

Regards,
Yitzhak
0
Atanas Korchev
Telerik team
answered on 13 Nov 2009, 07:34 AM
Hi,

Try wrapping the StyleSheetRegistrar inside a RadCodeBlock control:

<telerik:RadCodeBlock runat="server">

<% Html.Telerik().StyleSheetRegistrar()

.DefaultGroup(group => group.Add("telerik.common.css")

.Add("telerik.vista.css")).Render();

%>
</telerik:RadCodeBlock>

This is mandatory when you have a RadScriptManager in your page. By the way it is a good idea to put the RadScriptManager after all UI controls - at the end of your master page. In MVC scenarios this is vital for the proper operation of RadControls for ASP.NET Ajax.

Regards,
Atanas Korchev
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
General Discussions
Asked by
Kaleem Khan
Top achievements
Rank 1
Answers by
Yitzhak Khabinsky
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or