使用asp.net的MasterPage可以很方便的把类似页面中,不变的元素组织起来,减少重复劳动。

有时候,这些在继承了MasterPage的页面中,需要使用到MasterPage中定义的属性,要怎么调用呢?

方法:

使用this.Mater方法,把当前页的母版页还原为母版页中定义的类。

C#代码:(this.Master as mpUser).PublicProperty

注:假设当前页使用的母版页定义的类叫mpUser,并且其中有一个Public的属性PublicProperty

 

参考链接:http://topic.csdn.net/t/20060208/10/4544696.html
来源:http://ljf.cn

posted on 2008-02-22 21:28  8user  阅读(852)  评论(1编辑  收藏  举报