How to create a dynamic control in dot net?
Submitted by: AdministratorWe can create the dynamic control in the Page_Init() event or Page_Load() event,
protected void Page_Load(object sender, EventArgs e)
{
TextBox dynamicTextBox = new TextBox();
dynamicTextBox.ID = "DynamicTextBox";
dynamicTextBox.AutoPostBack = true;
dynamicTextBox.Text = "InitData";
dynamicTextBox.TextChanged += new EventHandler(dynamicTextBox_TextChanged);
this.Form.Controls.Add(dynamicTextBox);
}
void dynamicTextBox_TextChanged(object sender, EventArgs e)
{
Response.Write("hello");
}
Submitted by: Administrator
protected void Page_Load(object sender, EventArgs e)
{
TextBox dynamicTextBox = new TextBox();
dynamicTextBox.ID = "DynamicTextBox";
dynamicTextBox.AutoPostBack = true;
dynamicTextBox.Text = "InitData";
dynamicTextBox.TextChanged += new EventHandler(dynamicTextBox_TextChanged);
this.Form.Controls.Add(dynamicTextBox);
}
void dynamicTextBox_TextChanged(object sender, EventArgs e)
{
Response.Write("hello");
}
Submitted by: Administrator
Read Online Web Forms Job Interview Questions And Answers
Top Web Forms Questions
☺ | How to select multiple non-sequential dates at Code-Behind in Microsoft web forms? |
☺ | How to use PreviousPage on web forms? |
☺ | How to use Server.Transfer in dot net? |
☺ | How to disable some dates in Calendar control in web forms? |
☺ | How to upload an image files only in .net web forms? |
Top Dot Net Technologies Categories
☺ | MSF Interview Questions. |
☺ | .Net Architecture Interview Questions. |
☺ | ASP.Net MVC Interview Questions. |
☺ | Entity Framework Interview Questions. |
☺ | C# (Sharp) Programming Language Interview Questions. |