Hello,

I wish to know the protected property ChildControlsCreated property (to know the childrens of the Panel) when a button is clicked. Please tell me where I am wrong.The Label3.text should show "True" but displaying "false". why is that so?

It is the same for other properties like adapter.

regards

Manoj

protected void Button1_Click(object sender, EventArgs e)

{

    Panel pp = new Panel();

    TextBox t1 = new TextBox();

    pp.Controls.Add(t1);

    TextBox t2 = new TextBox();

    pp.Controls.Add(t2);


    class2 cc = new class2();

//Boolean bb2 = cc.xx1();

    Boolean bb2 = cc.b1;

    Label3.Text = bb2.ToString();

}

public class class2 : Panel

{ 

   public Boolean b1;

   public void xx1()

   {

      Panel pp = new Panel();

      TextBox t1 = new TextBox();

      pp.Controls.Add(t1);

      TextBox t2 = new TextBox();

      pp.Controls.Add(t2);

      b1 =base.ChildControlsCreated;

   }

}

Recommended Answers

All 2 Replies

Hi welcome here!
Could you please elaborate on what you are trying to achieve?

My understanding is the property you're looking for is available through webcontrols, you might need something like this:

public class class2 : System.Web.UI.WebControls.Panel
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.