Tin Can
Tin Can

Reputation: 2860

MVC3 Custom View Base

I'm just making the switch from webforms to Razor, and I'm pretty excited. While I'm doing all the refactoring of the views, I was wondering if it is possible to extend off the Razor base view. What I'm imagining is that all the views inherit a custom base view that extends (implements?) the Razor base.

If it is possible, then how would I go about it?

Thanks

Upvotes: 2

Views: 660

Answers (1)

Chuck Norris
Chuck Norris

Reputation: 15190

Yes, it possible with ViewStart... You can have _ViewStart.cshtml file in each subfolder and it will be base view for that subfolder...

Here is some information about it

http://weblogs.asp.net/gunnarpeipman/archive/2010/10/10/asp-net-mvc-3-beta-view-start-files-for-razor-view-engine.aspx

http://www.dotnetcurry.com/ShowArticle.aspx?ID=605

Upvotes: 1

Related Questions