Search code examples
c#visual-studiorunatserver

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>
    </div>

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


Solution

  • It's asking for a <form> element:

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