Click here to Skip to main content
15,894,307 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
if i add a calendar extender to the web form it shows this ..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) +8674071
   AjaxControlToolkit.ScriptObjectBuilder.RegisterCssReferences(Control control) +619
   AjaxControlToolkit.ExtenderControlBase.OnLoad(EventArgs e) +53
   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.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Posted

First start the javascript code block with <%# instead of <%= and add the following in your code behind:
C#
protected void Page_Load(object sender, EventArgs e)
{
  Page.Header.DataBind();    
}



--Amit
 
Share this answer
 
v3
Comments
Member 8388026 5-Sep-12 23:58pm    
which code block the ajax register or the calendar extender
_Amy 6-Sep-12 0:08am    
Wherever you used <%=.
Like $find('<%= txtName.ClientID %>') to $find('<%# txtName.ClientID %>')
You can use one of the following solutions depend upon your requirement:
1. Write your script inside the body tag of page.
2. Use steps mentioned in solution 1.
 
Share this answer
 
Hey see below link.
May be it will help you
Link 1[^]
 
Share this answer
 

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