无法将类型 'ASP.XXX_master' 的对象强制转换为类型 'XXX.MasterPage'



我想从使用它的页面访问母版页中的特定控件,因此我编写了以下代码行:

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));
            }
        }

这是抛出异常的代码。如何修复此错误

确保在该

页面上使用了与要转换到的母版页相同的母版页。

相关内容

最新更新