You are not logged in.

#1 2015-02-19 08:57:58

Ibraheem
Webmaster
From: Capital
Registered: 2012-03-16
Posts: 23,140
Website

How will you add a TextBox control at runtime on the form?

Question:
How will you add a TextBox control at runtime on the form? Choose the correct one?

Option A):
this.FindControl.add(TextBox);
Option B):
None of these all.
Option C):
TextBox obj = new TextBox();
obj.ID = "txtUserName";
form1.Controls.Add(obj);
Option D):
form1.Controls.Add(TextBox);

Correct Answer is Option C):
TextBox obj = new TextBox();
obj.ID = "txtUserName";
form1.Controls.Add(obj);

Explanation:
TextBox is a predefined class in ASP.NET. If you want to create TextBox control at runtime you have to create the object of TextBoxt class. Here obj is the instance of TextBox class. Then create the ID of the textbox control. At last add this control by using Add method.

2015-02-19 08:57:58

Advertisement
Ads By Google

Re: How will you add a TextBox control at runtime on the form?



Board footer