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

31 Views Asked by At

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>
1

There are 1 best solutions below

0
Skye MacMaster On BEST ANSWER

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>