Razor Tip #2 : Inheritance & Configuration
Posted by: K. Scott Allen,
on 13 Jan 2011 |
View original | Bookmarked: 0 time(s)
You can change the base class of a Razor view in ASP.NET MVC using an @inherits directive. @inherits MyWebViewPage<dynamic>
The default base class for a Razor view in ASP.NET MVC is WebViewPage<T>, and in most cases you don't need to fiddle with @inherits - it's more common to use the @model directive and just strongly type the default base class with a specific ViewModel type.
But, when you really need to set a different base class for a view, you'll probably need to set the same...