473,324 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Run-time error: <Control Name> must be placed inside a form tag with runat=server

It happend to me more than once. When I create web controls or move the
positions in VS.NET, I encountered the following run-time errors: It doesn't
matter what controls I create, the following 'checkbox' control is just an
example.
Control 'CheckBox1' of type 'CheckBox' must be placed inside a form tag with
runat=server.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Control 'CheckBox1' of type
'CheckBox' must be placed inside a form tag with runat=server.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
I know it's very easy to solve the problem, we simply move the code inside
the form block as follows:

<form id="Form1" method="post" runat="server">
'UI code
</form>

Maybe it's bug in VS.NET. I just want to see if anyone encountered similar
problem before.

Please advise. Thanks!


Nov 18 '05 #1
4 9927
All asp.net controls (i.e "<asp:') where the Runat=Server
must be within the form tag ( and I would guess even
those ASP controls which are not runat server, but not
absolutely sure about that) those asp.n and the form tag
must be runat=server as well.
-----Original Message-----
It happend to me more than once. When I create web controls or move thepositions in VS.NET, I encountered the following run- time errors: It doesn'tmatter what controls I create, the following 'checkbox' control is just anexample.
Control 'CheckBox1' of type 'CheckBox' must be placed inside a form tag withrunat=server.
Description: An unhandled exception occurred during the execution of thecurrent web request. Please review the stack trace for more informationabout the error and where it originated in the code.

Exception Details: System.Web.HttpException: Control 'CheckBox1' of type'CheckBox' must be placed inside a form tag with runat=server.
Source Error:

An unhandled exception was generated during the execution of the current webrequest. Information regarding the origin and location of the exception canbe identified using the exception stack trace below.
I know it's very easy to solve the problem, we simply move the code insidethe form block as follows:

<form id="Form1" method="post" runat="server">
'UI code
</form>

Maybe it's bug in VS.NET. I just want to see if anyone encountered similarproblem before.

Please advise. Thanks!


.

Nov 18 '05 #2
It's not a bug, it's a very much designed feature. Certain controls need to
exist inside a server form for them to work properly.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Matthew Louden" <ma*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
It happend to me more than once. When I create web controls or move the
positions in VS.NET, I encountered the following run-time errors: It doesn't matter what controls I create, the following 'checkbox' control is just an
example.
Control 'CheckBox1' of type 'CheckBox' must be placed inside a form tag with runat=server.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Control 'CheckBox1' of type
'CheckBox' must be placed inside a form tag with runat=server.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
I know it's very easy to solve the problem, we simply move the code inside the form block as follows:

<form id="Form1" method="post" runat="server">
'UI code
</form>

Maybe it's bug in VS.NET. I just want to see if anyone encountered similar
problem before.

Please advise. Thanks!

Nov 18 '05 #3
I know what you mean. I have had more IDE related problems with things like
this. Everything is ok , move a control and then things are wrong. I think
the IDE is about where VB2 was. Still not totally ready for prime time.

I keep losing toolbar buttons etc. and it is very frustrating.
"Matthew Louden" <ma*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
It happend to me more than once. When I create web controls or move the
positions in VS.NET, I encountered the following run-time errors: It doesn't matter what controls I create, the following 'checkbox' control is just an
example.
Control 'CheckBox1' of type 'CheckBox' must be placed inside a form tag with runat=server.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Control 'CheckBox1' of type
'CheckBox' must be placed inside a form tag with runat=server.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
I know it's very easy to solve the problem, we simply move the code inside the form block as follows:

<form id="Form1" method="post" runat="server">
'UI code
</form>

Maybe it's bug in VS.NET. I just want to see if anyone encountered similar
problem before.

Please advise. Thanks!

Nov 18 '05 #4
Or with second reading, if the problem is that IDE moves them out of the
form, then it could be a bug. :-)

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
It's not a bug, it's a very much designed feature. Certain controls need to exist inside a server form for them to work properly.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Matthew Louden" <ma*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
It happend to me more than once. When I create web controls or move the
positions in VS.NET, I encountered the following run-time errors: It

doesn't
matter what controls I create, the following 'checkbox' control is just an example.
Control 'CheckBox1' of type 'CheckBox' must be placed inside a form tag

with
runat=server.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Control 'CheckBox1' of type
'CheckBox' must be placed inside a form tag with runat=server.

Source Error:

An unhandled exception was generated during the execution of the current

web
request. Information regarding the origin and location of the exception

can
be identified using the exception stack trace below.
I know it's very easy to solve the problem, we simply move the code

inside
the form block as follows:

<form id="Form1" method="post" runat="server">
'UI code
</form>

Maybe it's bug in VS.NET. I just want to see if anyone encountered similar problem before.

Please advise. Thanks!


Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Steven Burn | last post by:
I'm curious as I am in need of advice on how I can move a site from an old Win 2K server, to it's new home on a Win 2003 server, without having to mess around with downloading/uploading the file's...
0
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I...
1
by: George Durzi | last post by:
I have a JavaScript called common.js that is referenced by every ASPX in my web application. In common.js, I have a funtion called findText (which I use to help me navigate through drop down lists...
1
by: z. f. | last post by:
Hi, adding a control with runat=server to an aspx page (using code - not designer view) - don't cause the control to be added to the code behind (.cs ot .vb file) only if i change the aspx...
2
by: John | last post by:
Hi I have dragged a few controls over to a web form. The html code generated is as follows; <asp:TextBox id="StaffCode" runat="server"></asp:TextBox>&nbsp; <asp:Button id="Submit"...
3
by: Ferryandi | last post by:
hi, i have created a button link like this and attach it to placeholder in code behind linkbutton1 = New LinkButton linkbutton1.Text = "Link Button linkbutton1.ID = "Link1"...
1
by: Bruce | last post by:
I use btnSave.Attributes.Add("onclick", "ShowMessage()") to link my web control button to a JavaScript function. It works well until I added a Validation control into the page. After that,...
2
by: John R. Lewis | last post by:
I posted this yesterday with a different email address. I am reposting with my fake-address as given to me by Microsoft so that I can be guraranteed a response from a support representative. Sorry...
13
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains...
12
by: Eric Layman | last post by:
Hi, What's the difference between a normal web element: <input type="text" id="txtname" name="txtname" runat="server"> vs webcontrol text box: <asp:Textbox id="username" Columns="10"...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.