Page Controls - FindControl - Form1

M

Mr Newbie

Hi ,

The following code in the Page_Load event will add a textbox to the webform.
The question is regarding the name of the form "Form1".

Q1.) Is this something which ASP.NET names arbitarily as "Form1" or is this
a default property somewhere
Q2.) And, just out of interest can this be changed?

Dim tb As New TextBox

tb.Text = "I'm Angry"

Page.FindControl("Form1").Controls.Add(tb)
 
G

Guest

1) If you look at your aspx page in HTML mode, you'll see that Visual Studio
does, by default, set the ID of the page's form control to Form1.

2) Yes, you can change it.
 
M

Mr Newbie

Thanks Andy, If I had thought a bit more before asking the question ( Idiot
that I am ) I could have worked it out.

Regards and Thanks Again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

FormView FindControl error 1
FindControl problem 2
problem with FindControl 2
Position of dynamically added controls 4
findcontrol 1
FindControl() usage 3
Findcontrol problem 2
Findcontrol issue 0

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top