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

[Solved] Telerik MVC Controls with ASP.NET Areas

2 Answers 182 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.
Darren
Top achievements
Rank 1
Darren asked on 02 Nov 2011, 06:32 PM
Hi All.

This post is meant as a help to those who, like me, have searched for help on using the Telerik MVC controls within a new ASP.NET Area and have trouble finding anything specific.  In order to get the controls working in an ASP.NET Area, there are two basic steps to follow:

1)  Add a web.config file to the Views folder in the new Area with a reference to the Telerik MVC controls, as shown below:
<system.web.webPages.razor>
    <host factoryType . . . />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        . . .
        <add namespace="Telerik.Web.Mvc" />
        <add namespace="Telerik.Web.Mvc.UI" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>

2) Add a new Partial View called _ViewStart to the Views folder in the new ASP.NET area with the following content:
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

This will set your default layout for all pages to the same layout as is used for the root of the application, including all references to CSS and JavaScript files.

I hope this helps.

-Darren

2 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 03 Nov 2011, 12:17 PM
Hi Darren,

Thank you for sharing your solution with the community - I am sure it will be of help to other users. If you want, you could provide a full demo project in our Code Library section and we will be glad to reward you with Telerik points in return :)


Regards,
Georgi Tunev
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
Brian Lanham
Top achievements
Rank 1
answered on 07 Dec 2011, 11:13 PM
Thank you very much!
Tags
General Discussions
Asked by
Darren
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Brian Lanham
Top achievements
Rank 1
Share this question
or