Click here to Skip to main content
15,896,502 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
i have one div with name "basicinfo"

i am adding dynamically (in c# page_load) "basicinfo" to panel or another div (i'm doing this for changing the position of the div dynamically based on some condition)

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

how can i fix this error
Posted

1 solution

There are two things you can try here for the fix :

1) If any script files exist in head section of web form, master page or in content page, remove those from the header section of page and add it to body of the page.

2) OR replace the codeblocks with <%# rather than <%=.

I hope any one of this will fix the issue.
 
Share this answer
 
Comments
yedhuvamshi 7-Nov-14 1:04am    
i have no head section in child page and removed <% blocks in master head page but not working

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