Got stuck on this! Debugging after adding a Rating Control to my aspx.page, I receive the Error:
System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
I know that the header <%= System.Web.Optimization.Scripts
are the cause.
To recap; everything compiles until adding Rating Control. If I set <%=
to <%#
+ Page.Header.DataBind();
page compiles but obviously not firing scripts.
So need some help with this! Thanks
[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
System.Web.UI.ControlCollection.Add(Control child) +9855103
AjaxControlToolkit.ToolkitResourceManager.RegisterCssReferences(Control control) +829
AjaxControlToolkit.ExtenderControlBase.OnLoad(EventArgs e) +81
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Control.LoadRecursive() +145
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
<head runat="server">
<title>bla</title>
<%= System.Web.Optimization.Styles.Render("~/css") %>
<%= System.Web.Optimization.Scripts.Render("~/bundles/jquery") %>
<%= System.Web.Optimization.Scripts.Render("~/bundles/stack") %>
$(document).ready(function () {
});
</script>