2

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

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

这是引发异常的代码。如何修复此错误

4

1 回答 1

2

确保您在该页面上使用的母版页与您要投射到的母版页相同。

于 2013-11-27T00:30:50.770 回答