asp.netrunatserver

Control 'windowMasterSearchBox' of type 'TextBox' must be placed inside a form tag with runat=server


Not sure where I'm going wrong in terms of not having a windowMasterSearchBox placed within a form tag with runat=server. I'm getting the following error: Control 'windowMasterSearchBox' of type 'TextBox' must be placed inside a form tag with runat=server. Any help would be appreciated. Thanks!

            <div class ="field">
                <a title="Search Students" id="windowMasterMagnifyingGlass"><img src="/images/icons/magnifyingBlack.png" alt="Search Students" border="0" /></a>
                    <asp:TextBox id="windowMasterSearchBox" runat="server" placeholder="Enter Student Name..."/>
                    <asp:Label id="windowMasterSearchBoxLabel" AssociatedControlId="windowMasterSearchBox" Text="Search: " runat="server"/>
            </div>

Solution

  • ASP.NET controls must be inside a form.

    <form runat="server">
    
        <div class ="field">
            <a title="Search Students" id="windowMasterMagnifyingGlass"><img src="/images/icons/magnifyingBlack.png" alt="Search Students" border="0" /></a>
            <asp:TextBox id="windowMasterSearchBox" runat="server" placeholder="Enter Student Name..."/>
            <asp:Label id="windowMasterSearchBoxLabel" AssociatedControlId="windowMasterSearchBox" Text="Search: " runat="server"/>
        </div>
    
    </form>