質問

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