我想从使用它的页面访问母版页中的特定控件,因此我编写以下代码行:
this.Master.FindControl("pnl_Buttonss").Visible = false;
现在
我从 .designer.cs 页面收到以下异常:
Unable to cast object of type 'ASP.masterpage2_master' to type 'GuideUI.MasterPage'.
public new GuideUI.MasterPage Master {
get {
return ((GuideUI.MasterPage)(base.Master));
}
}
这是抛出异常的代码。如何修复此错误
最佳答案
确保您在该页面上使用了与您要转换到的页面相同的母版页。
关于c# - 无法将类型 'ASP.XXX_master' 的对象强制转换为类型 'XXX.MasterPage',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13838700/