0

i have a web application which has a Base class in which i define all the properties common to the web pages. The base class extends System.Web.UI.Page

Furthermore i have a Base User control class where are defined all the properties common to the user controls. the Base User Control extends System.Web.UI.UserControl

all the properties in both base classes are protected.

All the web pages extends the base class .

All the controls extends the base user control class.

The problem is i can not access the properties defined in the base class from the user

controls and I can not extend two classes in the base user controls

The question is

how can i access the properties defined in the Base class from within the user controls?

I hope i have been clear

Thanks

4

1 に答える 1

0

自分のクラスまたはそのサブクラスの外部のプロパティを混乱させたい場合は、「保護された」が間違ったアクセスレベルである可能性があります。「保護された友達」(vb)または「保護された内部」(c#)アクセスを使用して、必要なことを実行できる場合があります。コントロールのクラスとページの基本クラスは同じアセンブリにある必要がありますが、それはおそらくあなたにとって問題ではありません。

于 2010-04-28T11:52:13.043 に答える