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

Using Telerik extension inside a hybrid webform/mvc app?

3 Answers 122 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.
Kenny
Top achievements
Rank 1
Kenny asked on 27 Nov 2009, 08:11 PM
I'm developing a hybrid app, with most of the site contents are in MVC except for the forums. I would like to use just a single masterpage for both portion and it seems like the only way is to create a MAIN masterpage using webform, then a sub-masterpage using MVC, pointing to the MAIN masterpage. Everything is working just fine, but as soon as I add the Telerik tags to the MVC portion of the masterpage to take advantage of the stylesheets/scripts registrar (combi/compress), I receive this error:

Server Error in '/' Application. 
 
A ViewMasterPage can be used only with content pages that derive from ViewPage or ViewPage<TViewItem>
 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.  
 
Exception Details: System.InvalidOperationException: A ViewMasterPage can be used only with content pages that derive from ViewPage or ViewPage<TViewItem>
 
Source Error:  
 
 
Line 5:         <asp:ContentPlaceHolder ID="TitleContent" runat="server" /> 
Line 6:     </title> 
Line 7:     <%= Html.Telerik().StyleSheetRegistrar() 
Line 8:          .DefaultGroup(style => 

Commenting out the <%= Html.Telerik()... code will make it work, and the Forums (webform) referencing this sub-masterpage (mvc masterpage) displays its contents just fine. Is there anyway to make the telerik extension work in this scenario?

Thank you very much,
Kenny.

3 Answers, 1 is accepted

Sort by
0
Kazi Manzur Rashid
Telerik team
answered on 30 Nov 2009, 04:46 PM
Hi Kenny,

It is not possible to use the same masterpage in both MVC and WebForms. So I  suggest that you create 3 Master page:

-CommonMasterPage
--MVC Masterpage
----Your MVC Page will use it.
--Forum Masterpage
----Your Forum Pages will use it.

Please let me know if you have any confusion.

Greetings,
Kazi Manzur Rashid
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.
0
Kenny
Top achievements
Rank 1
answered on 01 Dec 2009, 09:56 PM
Hi Kazi, the problem is that both my asp.net webform and asp.net mvc will be using a lot of same .css and javascript files... In MVC, using Telerik extension, I was able to combi and compress the css/script to a very small size file. If the Webform can't be using the same asp.net mvc masterpage, I have to reference to the css/script files UN-compress, UN-combi, which will lead to slow load time.

Unless, the generated (combi/compress css/script) file are static, meaning they won't change, then I suppose I can use the generated file name in the WebForm portion. For example, right now the generated combi/compressed css is this crazy long file name:

<link type="text/css" href="/asset.axd?id=zwAAAB-LCAAAAAAABADtvQdgHEmWJSYvbcp7f0r1StfgdKEIgGATJNiQQBDswYjN5pLsHWlHIymrKoHKZVZlXWYWQMztnbz33nvvvffee--997o7nU4n99__P1xmZAFs9s5K2smeIYCqyB8_fnwfPyJ-8UfT9qNHH7X5u_butGk-Gn10SX_u7ew8HN8b7-7u3Bvv0GfTjx619TqnX2YfPbr36f3RR_Tze7_4oxW1PamWbb5sqdU5f1Z99Ghn9NGSvmna6zJvxgD7S0b8xa5-URaz3P98Tz5v8zKvi7fjabVYVMvxolj6je6FjWb5ebYuW9fq-7_k-7_k_wFtR1EpzwAAAA%3d%3d" rel="stylesheet"/> 
 

If I can just copy and paste this to the WebForm masterpage, and the file won't be generated again, that would be great!!!

And with that in mind, can we somehow specify a name for the combi/compressed file in your feature versions?




Thanks,
Kenny.
0
Accepted
Kazi Manzur Rashid
Telerik team
answered on 02 Dec 2009, 11:04 PM
Hi Kenny,

I think if you paste the script/stylesheet tag in WebForm it should work, though I have not tested it. To reduce the size of the url of stylesheet and script you can read the following blog post:

http://weblogs.asp.net/rashid/archive/2009/11/09/web-asset-enhancements-in-telerik-extensions-for-asp-net-mvc.aspx

Regards,
Kazi Manzur Rashid
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
Kenny
Top achievements
Rank 1
Answers by
Kazi Manzur Rashid
Telerik team
Kenny
Top achievements
Rank 1
Share this question
or