locked
HttpException: Control 'ctl01' of type 'ScriptManager' must be placed inside a form tag with runat=server. RRS feed

  • Question

  • User-605499000 posted

    System.Web.HttpException: 'Error executing child request for ErrorPage.aspx.' (this was in the global file along with the subject matter above)

    This error turned up in the Global file and I have put in a form tag in the site master.  But it is not working.

    Below is the global  and then the site master what I put in.  Hope you can steer me in the right direction.

    Global last paragraph:

    void Application_Error(object sender, EventArgs e)
    {
    // Code that runs when an unhandled error occurs.

    // Get last error from the server
    Exception exc = Server.GetLastError();

    if (exc is HttpUnhandledException)
    {
    if (exc.InnerException != null)
    {
    exc = new Exception(exc.InnerException.Message);
    Server.Transfer("ErrorPage.aspx?handler=Application_Error%20-%20Global.asax",  (# error is on this line)

    Site master trying to fix it:

    <form id="form1" runat="server">
    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> I put this in per a suggestion
    </asp:ContentPlaceHolder>
    </form>

    <div class="container body-content">
    <asp:ContentPlaceHolder ID="MainContent" runat="server">(this paragraph was already in.)
    </asp:ContentPlaceHolder>

    <asp:TextBox id="txt" runat="server" />(I added this to because the error said that I had to put it in the site master form)
    <form id="frm" runat="server">
    </form>

     Thanks

    Jen

    Wednesday, November 7, 2018 6:28 PM

Answers

  • User-605499000 posted

    Thank you that is a big help.

    Jen

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 13, 2018 1:12 AM

All replies

  • User839733648 posted

    Hi bumples18,

    In ASP.NET Webforms, all server controls must be inside of a <form> tag.

    That tag must contain the runat="server" parameter.

    Also, ASP.NET expects each webform to contain one <form id="myFormName" runat="server"></form> tag.

    The runat="server" attribute indicates that the form should be processed on the server.

    It also indicates that the enclosed controls can be accessed by server scripts:

    <form runat="server">
    
    ...HTML + server controls...
    
    </form>

    So I think you should move your TextBox control into form tag.

    And you should pay attention that a page can have only one server-side Form tag

    For more about Master page, you could refer to:

    https://docs.microsoft.com/en-us/aspnet/web-forms/overview/older-versions-getting-started/master-pages/creating-a-site-wide-layout-using-master-pages-cs 

    Best Regards,

    Jenifer

    Thursday, November 8, 2018 6:22 AM
  • User-605499000 posted

    Thank you that is a big help.

    Jen

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 13, 2018 1:12 AM