Click here to Skip to main content
16,012,468 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The page is worked nicely...but when i run it now..it got this error...I really d't know how to solve it....plzzz help me...



XML
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:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

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) +8677511
   AjaxControlToolkit.ScriptObjectBuilder.RegisterCssReferences(Control control) +687
   AjaxControlToolkit.ScriptControlBase.OnLoad(EventArgs e) +44
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Posted

1 solution

In your aspx, replace the code block with <%# instead of <%=

In your code behind file than you need to do databinding in Page_Load event.
C#
Page.Header.DataBind();


Hope that helps
 
Share this answer
 
Comments
Member 9492907 12-Oct-12 10:24am    
its working i use <%# instead of <%=....thank you
MT_ 12-Oct-12 14:12pm    
Glad it helped. Do mark answer as solution/upvote. Thanks - Milind

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900