You are not logged in.

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

Muhammad
User RankUser RankUser RankUser RankUser RankUser Rank
بِسمِ اللَّهِ الرَّحمٰنِ الرَّحيمِ
From: Sahiwal Division
Registered: 2012-03-22
Posts: 22,197
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.


Online Web Tutorials And Interview Questions With Answers Forum:
https://globalguideline.com/forum/

2015-02-19 08:58:01

Advertisement
Ads By Google

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



\n

Board footer