如何解决这个问题..由于控件包含代码块(即<%...%>),因此无法修改Controls集合。 [英] How to fix this .. The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

查看:93
本文介绍了如何解决这个问题..由于控件包含代码块(即<%...%>),因此无法修改Controls集合。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为basicinfo的div



i动态添加(在c#page_load中)basicinfo到面板或另一个div(我这样做用于根据某些条件动态地改变div的位置)



i得到错误由于控件包含代码块(即<),因此无法修改控件集合。 %...%>)。



如何解决此错误

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

推荐答案

那里你可以在这里尝试修复两件事:



1)如果网页表单,母版页或内容页面的头部存在任何脚本文件,请删除从页面的标题部分添加到页面正文。



2)或者用<%#而不是<%=。<替换代码块。 br />


我希望其中任何一个能解决问题。
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.


这篇关于如何解决这个问题..由于控件包含代码块(即&lt;%...%&gt;),因此无法修改Controls集合。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆