web user control not rendering before page

I get an error "Control 'Header1_TextBox1' of type 'TextBox' must be placed inside a form tag with runat=server"
whenever I put in a textbox inside a web user control.

The problem is I have a header.ascx and a footer.ascx  that are reused throughout the application, but if I put a textbox inside the header.ascx control, I get the above error (which is an incorrect error).
If I build a page by itself with the contents of the header.ascx file and the contents of the footer.ascx file, then no error occurs.
Apparently, the page is being built before the control.

Here is how a default.aspx page (and every page with a header and footer) would be written:


<%@ Register TagPrefix="uc1" TagName="header" Src="controls/header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="footer" Src="controls/footer.ascx" %>
<%@ Page CodeBehind="default.aspx.vb" Language="vb" AutoEventWireup="false" Inherits="Ecom._default2" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
      <HEAD>
            <title>HTMLPage1</title>
            <meta name="vs_defaultClientScript" content="JavaScript">
            <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
            <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
            <meta name="ProgId" content="VisualStudio.HTML">
            <meta name="Originator" content="Microsoft Visual Studio .NET 7.1">
            <LINK href="../../include/ecom.css" type="text/css" rel="stylesheet">
      </HEAD>
      <body MS_POSITIONING="FlowLayout">
            <uc1:header id="Header1" runat="server"></uc1:header>
            body text
            <uc1:footer id="Footer1" runat="server"></uc1:footer>
      </body>
</HTML>




The header.ascx (its big):


<%@ Register TagPrefix="cc2" Namespace="Infinibit.ButtonControls" Assembly="ButtonControls" %>
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="header.ascx.vb" Inherits="Ecom.header" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<table id="Table1" cellSpacing="0" cellPadding="0" width="900" border="0">
      <tr>
            <td>
                  <table id="Table2" cellSpacing="0" cellPadding="0" width="100%" align="left" border="0">
                        <tr>
                              <td align="left" width="242"><IMG height="109" src="../images/_r1_c1.gif" width="242" border="0"></td>
                              <td align="left" width="110"><IMG height="109" src="../images/_r1_c8.jpg" width="110" border="0"></td>
                              <td align="left" width="38"><IMG height="109" src="../images/_r1_c9.gif" width="38" border="0"></td>
                              <td align="left">
                                    <table id="Table3" cellSpacing="0" cellPadding="0" width="100%" align="left" border="0">
                                          <tr>
                                                <td><IMG height="16" src="images/s.gif" width="504" border="0"></td>
                                          </tr>
                                          <tr>
                                                <td>
                                                      <table id="Table4" cellSpacing="0" cellPadding="0" width="100%" align="left" border="0">
                                                            <tr>
                                                                  <td align="left" width="254">
                                                                        <table id="Table5" cellSpacing="0" cellPadding="0" width="254" align="left" border="0">
                                                                              <tr>
                                                                                    <td bgColor="#533a73"><IMG height="14" src="images/s.gif" width="254" border="0"></td>
                                                                              </tr>
                                                                              <tr>
                                                                                    <td>
                                                                                          <table id="Table6" cellSpacing="0" cellPadding="0" width="254" align="left" border="0">
                                                                                                <tr>
                                                                                                      <td width="120" height="20" name="UAccount"><cc2:hoverlink id="btnNewAccount" EnableViewState="False" ImageUrl="../images/btnUNewAccount.gif"
                                                                                                                  runat="server" imgSrcMouseOver="../images/btnUNewAccount_f2.gif" imgSrcMouseDown="../images/btnUNewAccount_f3.gif" BorderWidth="0px"></cc2:hoverlink><cc2:hoverlink id="btnMyAccount" EnableViewState="False" ImageUrl="../images/btnUMyAccount.gif"
                                                                                                                  runat="server" imgSrcMouseOver="../images/btnUMyAccount_f2.gif" imgSrcMouseDown="../images/btnUMyAccount_f2.gif" BorderWidth="0px" Visible="False"></cc2:hoverlink></td>
                                                                                                      <td><IMG height="20" src="images/_r3_c11.gif" width="7" border="0"></td>
                                                                                                      <td width="120" height="20" name="ULogInOut"><cc2:hoverlink id="btnLogin" EnableViewState="False" ImageUrl="../images/btnULogin.gif" runat="server"
                                                                                                                  imgSrcMouseOver="../images/btnULogin_f2.gif" imgSrcMouseDown="../images/btnULogin_f3.gif" BorderWidth="0px"></cc2:hoverlink><cc2:hoverlink id="btnLogout" EnableViewState="False" ImageUrl="../images/btnULogout.gif" runat="server"
                                                                                                                  imgSrcMouseOver="../images/btnULogout_f2.gif" imgSrcMouseDown="../images/btnULogout_f3.gif" BorderWidth="0px" Visible="False"></cc2:hoverlink></td>
                                                                                                      <td><IMG height="20" src="images/_r3_c13.gif" width="7" border="0"></td>
                                                                                                </tr>
                                                                                          </table>
                                                                                    </td>
                                                                              </tr>
                                                                              <tr>
                                                                                    <td bgColor="#533a73"><IMG height="12" src="images/s.gif" width="254" border="0"></td>
                                                                              </tr>
                                                                              <tr>
                                                                                    <td><IMG height="1" src="images/_r6_c10.gif" width="254" border="0"></td>
                                                                              </tr>
                                                                              <tr>
                                                                                    <td bgColor="#999999"><IMG height="46" src="../images/s.gif" width="254" border="0"></td>
                                                                              </tr>
                                                                        </table>
                                                                  </td>
                                                                  <td align="left"><IMG height="93" src="images/_r2_c14.gif" width="1" border="0"></td>
                                                                  <td align="left">
                                                                        <table id="Table7" cellSpacing="0" cellPadding="0" width="100%" align="left" border="0">
                                                                              <tr>
                                                                                    <td width="100%" bgColor="#533a73"><IMG height="14" src="images/s.gif" width="100%" border="0"></td>
                                                                              </tr>
                                                                              <tr>
                                                                                    <td>
                                                                                          <table id="Table8" cellSpacing="0" cellPadding="0" width="100%" align="left" border="0">
                                                                                                <tr>
                                                                                                      <td width="7" bgColor="#533a73"><IMG height="20" src="images/s.gif" width="7" border="0"></td>
                                                                                                      <td width="120"><cc2:hoverlink id="btnViewCart" EnableViewState="False" ImageUrl="../images/btnUViewCart.gif" runat="server"
                                                                                                                  imgSrcMouseOver="../images/btnUViewCart_f2.gif" imgSrcMouseDown="../images/btnUViewCart_f3.gif" Height="20px"
                                                                                                                  BorderWidth="0px" Width="120px">View Shopping Cart Contents</cc2:hoverlink></td>
                                                                                                      <td width="8" bgColor="#533a73"><IMG height="20" src="images/s.gif" width="8" border="0"></td>
                                                                                                      <td width="49">
                                                                                                            <table id="Table9" cellSpacing="0" cellPadding="0" width="49" align="left" border="0">
                                                                                                                  <tr>
                                                                                                                        <td bgColor="#533a73"><IMG height="8" src="images/_r3_c20.gif" width="49" border="0"></td>
                                                                                                                  </tr>
                                                                                                                  <tr>
                                                                                                                        <td class="hdrcart" vAlign="bottom" align="left" width="49" bgColor="#533a73" height="12"
                                                                                                                              name="Items"><asp:label id="lblCartItems" runat="server" CssClass="hdrcart" BackColor="#533A73">999</asp:label></td>
                                                                                                                  </tr>
                                                                                                            </table>
                                                                                                      </td>
                                                                                                      <td width="100%">
                                                                                                            <table id="Table10" cellSpacing="0" cellPadding="0" width="100%" align="left" border="0">
                                                                                                                  <tr>
                                                                                                                        <td align="left" width="100%" bgColor="#533a73"><IMG height="8" src="images/_r3_c21.gif" width="65" border="0"></td>
                                                                                                                  </tr>
                                                                                                                  <tr>
                                                                                                                        <td class="hdrcart" vAlign="bottom" align="left" width="100%" bgColor="#533a73" height="12"
                                                                                                                              name="Subtotal"><asp:label id="lblCartTotal" runat="server" CssClass="hdrcart" BackColor="#533A73">$999.99</asp:label></td>
                                                                                                                  </tr>
                                                                                                            </table>
                                                                                                      </td>
                                                                                                </tr>
                                                                                          </table>
                                                                                    </td>
                                                                              </tr>
                                                                              <tr>
                                                                                    <td bgColor="#533a73"><IMG height="12" src="images/s.gif" width="249" border="0"></td>
                                                                              </tr>
                                                                              <tr>
                                                                                    <td><IMG height="1" src="images/_r6_c15.gif" width="249" border="0"></td>
                                                                              </tr>
                                                                              <tr>
                                                                                    <td align="left" width="100%" bgColor="#999999"><IMG height="12" src="images/s.gif" width="249" border="0"></td>
                                                                              </tr>
                                                                              <tr>
                                                                                    <td>
                                                                                          <table id="Table11" cellSpacing="0" cellPadding="0" width="100%" align="left" border="0">
                                                                                                <tr>
                                                                                                      <td width="7"><IMG height="20" src="images/_r8_c15.gif" width="7" border="0"></td>
                                                                                                      <td width="60" height="20" name="USearch"><cc2:hoversubmit id="btnSearch" ImageUrl="../images/btnSearch.gif" runat="server" imgSrcMouseOver="../images/btnSearch_f2.gif"
                                                                                                                  imgSrcMouseDown="../images/btnSearch_f3.gif" Text="Search"></cc2:hoversubmit></td>
                                                                                                      <td width="7" bgColor="#999999"><IMG height="20" src="images/s.gif" width="7" border="0"></td>
                                                                                                      <td noWrap align="left" width="172" bgColor="#ffffff" height="20"><asp:textbox id="TextBox1" runat="server" CssClass="forminput" Columns="20" MaxLength="50" BorderWidth="0px"></asp:textbox></td>
                                                                                                      <td width="100%" bgColor="#999999"><IMG height="20" src="images/s.gif" width="3" border="0"></td>
                                                                                                </tr>
                                                                                          </table>
                                                                                    </td>
                                                                              </tr>
                                                                              <tr>
                                                                                    <td bgColor="#999999"><IMG height="14" src="images/s.gif" width="249" border="0"></td>
                                                                              </tr>
                                                                        </table>
                                                                  </td>
                                                            </tr>
                                                      </table>
                                                </td>
                                          </tr>
                                    </table>
                              </td>
                        </tr>
                  </table>
            </td>
            <td>
                  <table id="Table12" cellSpacing="0" cellPadding="0" width="6" border="0">
                        <tr>
                              <td bgColor="#ffffff"><IMG height="16" src="images/s.gif" width="6" border="0"></td>
                        </tr>
                        <tr>
                              <td bgColor="#533a73"><IMG height="46" src="images/s.gif" width="4" border="0"></td>
                        </tr>
                        <tr>
                              <td bgColor="#ffffff"><IMG height="1" src="images/s.gif" width="6" border="0"></td>
                        </tr>
                        <tr>
                              <td bgColor="#999999"><IMG height="46" src="images/s.gif" width="6" border="0"></td>
                        </tr>
                  </table>
            </td>
      </tr>
      <tr>
            <td>
                  <table id="Table13" cellSpacing="0" cellPadding="0" width="894" border="0">
                        <tr>
                              <td width="2" bgColor="#533a73" height="645"><IMG src="images/s.gif" width="2" border="0"></td>
                              <td width="4" bgColor="#eeeeee" height="645"><IMG src="images/s.gif" width="4" border="0"></td>
                              <td vAlign="top" bgColor="#eeeeee">
                                    <table id="Table14" cellSpacing="0" cellPadding="0" width="150" border="0">
                                          <tr>
                                                <td bgColor="#eeeeee"><IMG height="10" src="images/s.gif" width="150" border="0"></td>
                                          </tr>
                                          <tr>
                                                <td><IMG height="15" src="images/_r11_c3.gif" width="150" border="0"></td>
                                          </tr>
                                          <tr>
                                                <td class="cattreeb" id="sidemenu" vAlign="top" align="left" width="150" bgColor="#eeeeee"
                                                      height="610"></td>
                                          </tr>
                                          <tr>
                                                <td bgColor="#eeeeee"><IMG height="10" src="images/s.gif" width="150" border="0"></td>
                                          </tr>
                                    </table>
                              </td>
                              <td width="4" bgColor="#eeeeee" height="645"><IMG src="images/s.gif" width="4" border="0"></td>
                              <td width="2" bgColor="#533a73" height="645"><IMG src="images/s.gif" width="2" border="0"></td>
                              <td width="4" bgColor="#ffffff" height="645"><IMG src="images/s.gif" width="4" border="0"></td>
                              <td>
                                    <table id="Table15" cellSpacing="0" cellPadding="0" width="728" border="0">
                                          <tr>
                                                <td bgColor="#ffffff"><IMG height="10" src="images/s.gif" width="728" border="0"></td>
                                          </tr>
                                          <tr>
                                                <td class="text" vAlign="top" align="left" width="728" height="625" name="BODY">

**********************************************************************************************************************


And the footer:


<%@ Control Language="vb" AutoEventWireup="false" Codebehind="footer.ascx.vb" Inherits="Ecom.footer" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
</td>
                                                            </tr>
                                                            <tr>
                                                                  <td bgcolor="#ffffff"><img src="images/s.gif" width="728" height="10" border="0"></td>
                                                            </tr>
                                                      </table>
                                                </td>
                                          </tr>
                                    </table>
                              </td>
                              <td vAlign="top" height="100%">
                                    <table border="0" cellpadding="0" cellspacing="0" width="6" ID="Table16" height="100%"
                                          align="left">
                                          <tr>
                                                <td width="4" height="100%" bgcolor="#ffffff"><img src="images/s.gif" width="4" height="645" border="0"></td>
                                                <td width="2" height="100%" bgcolor="#533a73"><img src="images/s.gif" width="2" height="645" border="0"></td>
                                          </tr>
                                    </table>
                              </td>
                        </tr>
                        <tr>
                              <td><table border="0" cellpadding="0" cellspacing="0" width="100%" ID="Table17" align="left">
                                          <tr>
                                                <td width="6"><img src="images/_r14_c1.gif" width="6" height="23" border="0"></td>
                                                <td><table border="0" cellpadding="0" cellspacing="0" width="100%" ID="Table18" align="left">
                                                            <tr>
                                                                  <td bgcolor="#999999" width="100%"><img src="images/s.gif" width="888" height="5" border="0"></td>
                                                            </tr>
                                                            <tr>
                                                                  <td id="ftrlinks" width="100%" height="13" bgcolor="#999999" class="ftrlinks" align="center"
                                                                        nowrap>Links</td>
                                                            </tr>
                                                            <tr>
                                                                  <td bgcolor="#999999" width="100%"><img src="images/s.gif" width="888" height="5" border="0"></td>
                                                            </tr>
                                                      </table>
                                                </td>
                                          </tr>
                                    </table>
                              </td>
                              <td width="6"><img src="images/_r14_c23.gif" width="6" height="23" border="0"></td>
                        </tr>
                        <tr>
                              <td>
                                    <table border="0" cellpadding="0" cellspacing="0" width="894" ID="Table19">
                                          <tr>
                                                <td width="6"><img src="images/_r17_c1.gif" width="6" height="1" border="0"></td>
                                                <td bgcolor="#ffffff"><img src="images/s.gif" width="888" height="1" border="0"></td>
                                          </tr>
                                    </table>
                              </td>
                              <td width="6"><img src="images/_r17_c23.gif" width="6" height="1" border="0"></td>
                        </tr>
                        <tr>
                              <td><table border="0" cellpadding="0" cellspacing="0" width="100%" ID="Table20" align="left">
                                          <tr>
                                                <td width="6"><img src="images/_r18_c1.gif" width="6" height="22" border="0"></td>
                                                <td><table border="0" cellpadding="0" cellspacing="0" width="100%" ID="Table21" align="left">
                                                            <tr>
                                                                  <td bgcolor="#533a73" width="100%"><img src="images/s.gif" width="888" height="5" border="0"></td>
                                                            </tr>
                                                            <tr>
                                                                  <td id="copyinfo" width="100%" height="13" bgcolor="#533a73" class="ftrcopy" align="center"
                                                                        nowrap>Copyright Info</td>
                                                            </tr>
                                                            <tr>
                                                                  <td bgcolor="#533a73" width="100%"><img src="images/s.gif" width="888" height="4" border="0"></td>
                                                            </tr>
                                                      </table>
                                                </td>
                                          </tr>
                                    </table>
                              </td>
                              <td width="6"><img src="images/_r18_c23.gif" width="6" height="22" border="0"></td>
                        </tr>
                  </table>




*********************************************************************************************************************

Any ideas how to fix this?
simplyamazingAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

amit_gCommented:
You are missing a form tag ...


     <body MS_POSITIONING="FlowLayout">
        <form Runat="server" ID="MyForm">
          <uc1:header id="Header1" runat="server"></uc1:header>
          body text
          <uc1:footer id="Footer1" runat="server"></uc1:footer>
        </form>
     </body>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
simplyamazingAuthor Commented:
DOH!  (as Homer Simpson would exclaim)

The 'ole disappearing form tag.  I must've deleted it somehow .

Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.