The control "ctl00_TextBox1" of type "TextBox" must be placed inside the form tag using runat = server

When adding a form with a launch on the server, there will be two forms with the runat server and another error will occur. Can someone give me an idea. Thankx in advance.

The error details are as follows.

The control 'ctl00_TextBox1' of type 'TextBox' must be placed in the form tag using runat = server. Description: An unhandled exception occurred during the execution of the current web request. Check the stack trace for more information about the error and where it appeared in the code.

Exception Details: System.Web.HttpException: The control 'ctl00_TextBox1' of type 'TextBox' must be placed inside the form tag using runat = server.

Source Error:

An unhandled exception was thrown during the execution of the current web request. Information about the origin and location of the exception can be identified using the exception stack trace below.

Stack trace:

[HttpException (0x80004005): Control 'ctl00_TextBox1' of type 'TextBox' should be placed inside the form tag with Runat = server.]
System.Web.UI.Page.VerifyRenderingInServerForm (Control control) +2052287
System.Web.UI.WebControls.TextBox .AddAttributesToRender (HtmlTextWriter writer) +49 System.Web.UI.WebControls.WebControl.RenderBeginTag (HtmlTextWriter writer) +17
System.Web.UI.WebControls.TextBox.Render (HtmlTextWriter writer) +17
System. RenderControlInternal (HtmlTextWriter writer, adapter adapter) +25
System.Web.UI.Control.RenderControl (HtmlTextWriter writer, adapter adapter) +121
System.Web.UI.Control.RenderControl (HtmlTextWriter writer) +22
System.Web.UI.Control.RenderChildrenInternal (HtmlTextWriter writer, children ICollection) +199
System.Web.UI.Control.RenderChildren (HtmlTextWriter writer) +20
System.Web.UI.Control.Render (HtmlTextWriter writer)

System.Web. UI.Control.RenderControlInternal (HtmlTextWriter writer, adapter adapter) +25
System.Web.UI.Control.RenderControl (HtmlTextWriter writer, adapter adapter) +121
System.Web.UI.Control.RenderControl (HtmlTextWriter writer) +22
System.Web .UI.Control.RenderChildrenInternal (HtmlTextWriter writer, ICollection children) +199
System.Web.UI.Control.RenderChildren (HtmlTextWriter writer) +20
System.Web.UI.Page.Render (HtmlTextWriter writer) +26
System.Web.UI.Control.RenderControlInternal (HtmlTextWriter writer, adapter adapter) +25
System.Web.UI.Control.RenderControl (HtmlTextWriter writer, adapter adapter) +121
System.Web.UI.Control.RenderControl (HtmlTextWriter writer) + 22
System.Web.UI.Page.ProcessRequestMain (Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2558

Version Information: Microsoft.NET Framework Version: 2.0.50727.1873; ASP.NET Version: 2.0.50727.1433

+3
source share
7 answers

An error indicates a problem.

Correct

<form id="frm" runat="server">
    <asp:TextBox id="txt" runat="server" />
</form>

Incorrect

<asp:TextBox id="txt" runat="server" />
<form id="frm" runat="server">
</form>
+8
source

"master-pages", , , (, , ) , .

runat = "server". .

, - , . ,

aspx ,

<asp:Panel ID="Panel1" runat="server">
</asp:Panel>   

,

        Dim txtbox As New textbox()
        Panel1.Controls.Add(txtbox)
+4

- , runat = "server" ( runat = "server" ). ASP.NET runat = "server" .

+1

ASP.Net . ASP.Net. , <FORM>, MVC - .

0

. , , PageWrapper, . :

<body>
 <div ID="PageWrapper">
    <form ID="form1" runat="server">
        <div ID="Header">...</div>
        <div ID="MainContent">...</div>
         ...
    </form>
 </div>
</body>

- . , .

0

You did not say where this control is in your form.

If this error is the result of another control being inside the GridView control, just like mine, this can also help you:

An xxx control of type 'LinkButton' must be placed inside the form tag using runat = server

0
source

The error is a "txtTo" of type "TextBox", which should be placed inside the form tag using the runat = server.

ERROR is a code.

      <tr>
          <td class="style1">
                <strong>To </strong>
            </td>
            <td class="style2">
                <strong>: </strong>
            </td>
            <td class="style6">
                &nbsp;
                <asp:TextBox ID="txtTo" runat="server" Width="475px"></asp:TextBox>
            </td>
            <td></td>
        </tr>
0
source

Source: https://habr.com/ru/post/1737988/


All Articles