I have Page
, MasterPage
and UserControl
in my project.
So I create basepage
class and share some logic, then inherit开发者_开发知识库 from System.Web.UI.Page. My problem is I want use single basePage for any type of UI content.
You can not inherit from multiple base classes in .NET, so you can not do what you are looking at here.
However, you probably do not need to do it. Page
, MasterPage
and UserControl
can all access the currently rendering Page
and MasterPage
instances via properties. You can then test their actual types and cast them appropriately, to gain access to the common code you need.
精彩评论