Posted on: 6/10/2011 3:44:13 AM | Views : 468

Hi,
I am declaring a dynamic control in preinit event of ASP.NET life cycle and assigning properties to this control in init event of ASP.NET life cycle. But when I assign value to properties in init event, it displays the error that it is not able to find this control. The code is the following:
protected void Page_PreInit(object sender, EventArgs e)
{
 TextBox txt=new Textbox();
this.form1.Controls.Add(txt);
}
protected void Page_Init(object sender, EventArgs e)
{
 txt.Text="Hello World!";
txt.Width=100;
txt.ReadOnly="true"
}
 Thanks
...

Go to the complete details ...