Server Error in '/' Application.

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Source Error:


Line 63:             HtmlHead head = (HtmlHead)Page.Header;
Line 64: 
Line 65:             head.Controls.Add(hm1);
Line 66:             head.Controls.Add(hm2);
Line 67:             head.Controls.Add(hm3);

Source File: c:\OneDrive\wwwroot\canaldeleiloes\texto.aspx.cs    Line: 65

Stack Trace:


[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
   System.Web.UI.ControlCollection.Add(Control child) +11660844
   texto.FormView1_DataBound(Object sender, EventArgs e) in c:\OneDrive\wwwroot\canaldeleiloes\texto.aspx.cs:65
   System.Web.UI.WebControls.BaseDataBoundControl.OnDataBound(EventArgs e) +126
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +134
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +106
   System.Web.UI.Control.EnsureChildControls() +107
   System.Web.UI.Control.PreRenderRecursiveInternal() +58
   System.Web.UI.Control.PreRenderRecursiveInternal() +227
   System.Web.UI.Control.PreRenderRecursiveInternal() +227
   System.Web.UI.Control.PreRenderRecursiveInternal() +227
   System.Web.UI.Control.PreRenderRecursiveInternal() +227
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3671


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4700.0