Thursday, March 22, 2012

Newbie:Simple 'textbox' causing this error ?

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">
</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">
</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">
</td>
</tr>
</table>
<br />
<asp:textbox id="TextBox1" runat="server"></asp:textbox>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" <maggo@.nospasm.com> wrote in message news:<e3bTJqFJFHA.904@.tk2msftngp13.phx.gbl
>...
> 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 w
eb
> request. Information regarding the origin and location of the exception ca
n
> 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, ControlAdapt
er
> 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, ControlAdapt
er
> 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.NE
T
> 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">
>
> </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">
> </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">
> </td>
> </tr>
> </table>
> <br />
> <asp:textbox id="TextBox1" runat="server"></asp:textbox>
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>
Posted Via mcse.ms Premium Usenet Newsgroup Services
----
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----
http://www.mcse.ms
i have this problem too...
sometimes the code is deleted or isnt added correctly!
is that a bug of VS2005?
Posted Via mcse.ms Premium Usenet Newsgroup Services
----
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----
http://www.mcse.ms

0 comments:

Post a Comment