In ASP.NET MVC, why can't I inherit from "MyCustomView" without specifying the full type name?
Posted
by Seth Petry-Johnson
on Stack Overflow
See other posts from Stack Overflow
or by Seth Petry-Johnson
Published on 2010-04-21T15:21:52Z
Indexed on
2010/04/21
15:23 UTC
Read the original article
Hit count: 319
asp.net-mvc
In my MVC apps I normally declare a base view type that all of my views inherit from. I get a parser error when I specify Inherits="MyView"
in my Page declaration, but not if I specify Inherits="MyApp.Web.Views.MyView"
.
Strangely enough, it also works fine if I specify Inherits="MyView<T>
(where T is any valid type).
Why can I specify a strongly typed view without the full type name, but not a generic view?
My base view class is declared like this:
namespace MyApp.Web.Views {
public class MyView : MyView<object> {
}
public class MyView<TModel> : ViewPage<TModel> where TModel : class {
}
}
© Stack Overflow or respective owner