Afshin Mehrabani
Afshin Mehrabani

Reputation: 34929

Compilation Error in MVC3 custom WebViewPage

I want to use my own WebViewPage in MVC3 and When I create an abstract class with specific name and change the WebViewPage to my own type in Web.config, I get this error:

 Compiler Error Message: CS0308: The non-generic type 'Aya.Moj.Web.Controllers.MojWebViewPage' cannot be used with type arguments

Custom WebViewPage code:

namespace Aya.Moj.Web.Controllers
{
    public abstract class MojWebViewPage : WebViewPage
    {
        //just for test
        public string Boo { set; get; }
    }
}

Upvotes: 2

Views: 674

Answers (1)

Wahid Bitar
Wahid Bitar

Reputation: 14084

You should inherit from WebViewPage<TModel> because you're going to pass a Model to this WebViewPage Then your WebViewPage will look like this :

namespace Aya.Moj.Web.Controllers
{
    public abstract class MojWebViewPage<T> : WebViewPage<T>
    {
        //just for test
        public string Boo { set; get; }
    }
}

Upvotes: 5

Related Questions