0
我有一个使用MasterPage的ASP.NET页面。我在名为ShowChangePassword
的MasterPage中有public
bool
属性。我想在使用此MasterPage的页面中将其设置为true或false。ASP.NET - 如何在页面代码中获取并设置MasterPage属性?
我有下面的代码,但我不能设置属性:
var masterPage = this.Master;
masterPage.ShowChangePassword = false;
什么代码,我需要做到这一点?
我试过,但没有奏效 - 母版不具有<%@ Page指令。你的意思是把两个服务器标签放在主页面上吗?为什么要引用主页面中的masterPageFile> – Theomax 2012-02-17 13:41:06
@aspdotnetuser:必须将MasterType标记放入要引用母版页的ContentPage中。 – Mithrandir 2012-02-17 13:43:02