-2
我有一个带有Accordion控件和按钮(该页面基于母版页)的aspx页面(Default.aspx)。 里面一个这个手风琴的窗格中我有一个用户控件,这样的事情:来自userControl的FindControls在内容aspx中的Accordion页面
<Content>
<ucDetails:Details ID="userControlDetails" runat="server" />
</Content>
现在我需要在aspx页面我的用户里面的按钮的Enabled属性的访问。
到现在为止我已经试过:
Button btnSend1 = (Button) this.NamingContainer.FindControl("btnSendRequest");
Button btnSend2 = (Button) Page.Parent.Parent.FindControl("btnSendRequest");
Button btnSend3 = (Button) Page.Parent.FindControl("btnSendRequest");
第一个返回NULL 和其他人返回异常(“对象未设置实例的......”)。
我在哪里错了?
在此先感谢。
路易吉 :
我试过这个: Button btnSend1 = new Button(); btnSend1 =(Button)Parent.FindControl(“btnSend1”); bool enabled = btnSend1.Enabled; 但它给了null。 userControl位于Default.aspx页面中的Accordion窗格内。 Luigi – Ciupaz 2012-02-14 08:46:37