문제

I have an asp.net website with individual .aspx files which all inherit my Custom Class. There are common features to each .aspx page such as menus and things like that. So I have created a Master Page.

I want to put the common methods which call methods from my custom class in my master page code behind and I cannot. As I don't seem to be able to get my Master Page to inherit from it.

I want to change the following..

Partial Class modules_MyPage
Inherits System.Web.UI.MasterPage

To something like this...

 Partial Class modules_MyPage
Inherits MyCustomClass

The above damages my content pages. I was wondering if anyone could advise me on the right approach.

도움이 되었습니까?

해결책

What you want is something like this:

Partial Class modules_MyPage Inherits MyCustomClass

where

Partial Class MyCustomClass Inherits System.Web.UI.MasterPage

but this isn't possible if your class already inherit from web.ui.Page

really usefull article

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top