2012-02-13 20 views
-2

私はAccordionコントロールとボタン(このページはマスターページに基づいています)を持つaspxページ(Default.aspx)を持っています。私は、このような何かユーザーコントロールを持っているこのアコーディオンの1つのペイン内 :コンテンツaspxページのAccordion内のuserControlのFindControls

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

最初の1つの戻りNULL と他の人が(「インスタンスの設定されていないオブジェクト参照...」)例外を返します。

どこが間違っていますか?

ありがとうございます。

ルイージ :

答えて

0
Button btnSend1 = new Button(); 
    btnSend1 = (Button)userControlDetails.FindControl("btnSend1"); 
    bool enabled = btnSend1.Enabled; 

は、これはあなたがのために行っているとは何ですか?

+0

私はこれを試しています: ボタンbtnSend1 =新しいボタン(); btnSend1 =(ボタン)Parent.FindControl( "btnSend1"); bool enabled = btnSend1.Enabled; しかし、それは私にnullを与える。 userControlは、Default.aspxページのアコーディオンペインの内側にあります。 ルイージ – Ciupaz

関連する問題