Newbie:Simple 'textbox' causing this error ?

M

Mr. Magoo

In VS 2005, I attempt to build my VB (.aspx) application:
I simply drag and drop a Label text and a "textbox".

When I hit F5, I get the error below. Obviously it is being caused by
something missing the in the 'textbox' property. What's wrong ?
Server Error in '/P2' Application.
--------------------------------------------------------------------------------

Control 'TextBox1' of type 'TextBox' 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 'TextBox1' of type
'TextBox' 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.

Stack Trace:


[HttpException (0x80004005): Control 'TextBox1' of type 'TextBox' must be
placed inside a form tag with runat=server.]
System.Web.UI.Page.VerifyRenderingInServerForm(Control control) +160
System.Web.UI.WebControls.TextBox.AddAttributesToRender(HtmlTextWriter
writer) +45
System.Web.UI.WebControls.WebControl.RenderBeginTag(HtmlTextWriter
writer) +22
System.Web.UI.WebControls.TextBox.Render(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +61
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
adapter) +302
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +31
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +167
System.Web.UI.Page.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +61
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
adapter) +302
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +31
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6607




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.40607.16; ASP.NET
Version:2.0.40607.16

Here is the source code:
<script runat="server">

Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

End Sub

Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs)

End Sub

Sub TextBox1_TextChanged1(ByVal sender As Object, ByVal e As
System.EventArgs)

End Sub
</script>
<script language="javascript" type="text/javascript" for="document"
event="ondatasetcomplete">
<!--
return document_ondatasetcomplete()
// -->
</script>

<script language="javascript" type="text/javascript">
<!--

function document_ondatasetcomplete() {

}

// -->
</script>
<span style="font-family: Tahoma; background-color: #ffffff"></span>
<br />
<table enableviewstate="true">
<tr>
<td style="width: 325px">
<asp:label id="Label1" runat="server" text="1. What's your
favorite pet's name ?" width="311px" height="19px"></asp:label>
</td>
<td style="width: 455px">
&nbsp;&nbsp;
</td>
</tr>
<tr>
<td style="width: 325px; height: 21px">
<asp:label id="Label2" runat="server" text="2. What's your
mother's birthday ?" width="311px" height="19px"></asp:label>
</td>
<td style="width: 455px; height: 21px">
&nbsp;</td>
</tr>
<tr>
<td style="width: 325px">
<asp:label id="Label3" runat="server" text="3. What's your
father's first name ?" width="311px" height="19px"></asp:label>
</td>
<td style="width: 455px">
&nbsp;</td>
</tr>
</table>
<br />
<asp:textbox id="TextBox1" runat="server"></asp:textbox>
 
A

Amar

Go at design mode of your form, click html view and ensure that
<asp:textbox id="TextBox1" runat="server"></asp:textbox>
control is within <form> tag
you cannot place an asp control outside the <form> tag


Mr. Magoo said:
In VS 2005, I attempt to build my VB (.aspx) application:
I simply drag and drop a Label text and a "textbox".

When I hit F5, I get the error below. Obviously it is being caused by
something missing the in the 'textbox' property. What's wrong ?
Server Error in '/P2' Application.
--------------------------------------------------------------------------------

Control 'TextBox1' of type 'TextBox' 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 'TextBox1' of type
'TextBox' 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.

Stack Trace:


[HttpException (0x80004005): Control 'TextBox1' of type 'TextBox' must be
placed inside a form tag with runat=server.]
System.Web.UI.Page.VerifyRenderingInServerForm(Control control) +160
System.Web.UI.WebControls.TextBox.AddAttributesToRender(HtmlTextWriter
writer) +45
System.Web.UI.WebControls.WebControl.RenderBeginTag(HtmlTextWriter
writer) +22
System.Web.UI.WebControls.TextBox.Render(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +61
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
adapter) +302
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +31
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +167
System.Web.UI.Page.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +61
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
adapter) +302
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +31
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6607




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.40607.16; ASP.NET
Version:2.0.40607.16

Here is the source code:
<script runat="server">

Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

End Sub

Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs)

End Sub

Sub TextBox1_TextChanged1(ByVal sender As Object, ByVal e As
System.EventArgs)

End Sub
</script>
<script language="javascript" type="text/javascript" for="document"
event="ondatasetcomplete">
<!--
return document_ondatasetcomplete()
// -->
</script>

<script language="javascript" type="text/javascript">
<!--

function document_ondatasetcomplete() {

}

// -->
</script>
<span style="font-family: Tahoma; background-color: #ffffff"></span>
<br />
<table enableviewstate="true">
<tr>
<td style="width: 325px">
<asp:label id="Label1" runat="server" text="1. What's your
favorite pet's name ?" width="311px" height="19px"></asp:label>
</td>
<td style="width: 455px">
&nbsp;&nbsp;
</td>
</tr>
<tr>
<td style="width: 325px; height: 21px">
<asp:label id="Label2" runat="server" text="2. What's your
mother's birthday ?" width="311px" height="19px"></asp:label>
</td>
<td style="width: 455px; height: 21px">
&nbsp;</td>
</tr>
<tr>
<td style="width: 325px">
<asp:label id="Label3" runat="server" text="3. What's your
father's first name ?" width="311px" height="19px"></asp:label>
</td>
<td style="width: 455px">
&nbsp;</td>
</tr>
</table>
<br />
<asp:textbox id="TextBox1" runat="server"></asp:textbox>
 
S

sumsin

Hi
Put your TextBox Control inside the Form tag with the property runat =
server like this :


<form id="Form1" method="post" runat="server">
<asp:TextBox id="TextBox1"
runat="server"></asp:TextBox>
</form>
 
A

Apollo0130

i have this problem too...
sometimes the code is deleted or isn´t added correctly!
is that a bug of VS2005???
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top