Create a strongly typed view which inherites a class which is concrete

Posted by Ashwani K on Stack Overflow See other posts from Stack Overflow or by Ashwani K
Published on 2010-05-04T05:39:50Z Indexed on 2010/05/04 5:48 UTC
Read the original article Hit count: 312

Filed under:
|

Hello All:

I am having one class called BaseClass which contains some logic applicable to whole web site.

In order to create a strongly typed view we need to inherit the page from System.Web.Mvc.ViewPage generic class. But In our case I have to Inherit the BaseClass from System.Web.Mvc.ViewPage to apply some common settings, but the BaseClass should be inherited from System.Web.Mvc.ViewPage<> generic version. But I cannot inherit the BaseClass from System.Web.Mvc.ViewPage<> as it will change other class also. So I created one more class of type BaseClass<> inheriting it from System.Web.Mvc.ViewPage<> and copied the whole code of BaseClass in BaseClass<>. But the code in BaseClass is controlled by other team so it will be changed frequently so my BaseClass<> should be in sync with BaseClass. Please help me in eliminating the code duplication or any other approach to make strongly typed View.

Thanks Ashwani

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about c#