Click here to Skip to main content
11,494,174 members (68,763 online)
Rate this: bad
good
Please Sign up or sign in to vote.
Dear Friends,

I have create a user control and used in few pages.
In all the pages it works fine but where ever I am using calendar extender, it show following error.
Kindly suggest.

Server Error in '/new' 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:
 
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.
Posted 1-Jan-13 18:37pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Have a look at below link:
The Controls Collection Cannot Be Modified Because the Control Contains Code Blocks[^]

Also you will find more answers here[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi


start the code block with <%# instead of <%=


<head id="head1" runat="server">
  <title>My Page</title>
  <link href="css/common.css" rel="stylesheet" type="text/css" />
  <script type="text/javascript" src="<%# ResolveUrl("~/javascript/leesUtils.js") %>"></script>
</head>
 

 

Check this solution:-


http://leedumond.com/blog/the-controls-collection-cannot-be-modified-because-the-control-contains-code-blocks/[^]


Please Mark as Answer if find helpful..

Happy coding...
  Permalink  
Comments
Arunprasath Natarajan at 3-Jan-13 23:08pm
   
Tan q, It helps.

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 448
1 Nakul Chaudhari 240
2 OriginalGriff 225
3 F-ES Sitecore 219
4 CPallini 215
0 Sergey Alexandrovich Kryukov 10,237
1 OriginalGriff 8,730
2 Sascha Lefèvre 3,664
3 Maciej Los 3,392
4 Richard Deeming 2,500


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100