Marcus Marcus - 1 year ago 70
C# Question

Visual studio asks for runat server tag on a component that alreayd has it

TextBox1 must be placed inside a form tag with runat=server is the error I get, my code is as follows.

<div >

<asp:Label ID="Label1" runat="server" Text="User"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" class="form-control"></asp:TextBox>

I was wondering why I get this error, and how I can fix it.

Dai Dai
Answer Source

It's asking for a <form> element:

<form runat="server">
        <asp:Label ID="Label1" runat="server" Text="User" />
        <asp:TextBox ID="TextBox1" runat="server" class="form-control" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download