我们刚刚将我们的应用程序从 ASP.Net 2.0 更新到了 ASP.Net 4.0。
我们已经在 web.config 中包含了<system.web>
元素:
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
我的理解是,这应该使控件与 .Net 2.0/3.5 相同。
然而......它不是......这是一个例子
这是在 2.0 中呈现的:
<input id="grdUserEntity__ctl1_chkSelectAll" type="checkbox"
name="grdUserEntity:_ctl1:chkSelectAll" onclick="javascript:iSelectAll();" />
这是在 4.0 中:
<input id="grdUserEntity_ctl01_chkSelectAll" type="checkbox"
name="grdUserEntity$ctl01$chkSelectAll" onclick="javascript:iSelectAll();" />
区别:
2.0 id=grdUserEntity__ctl1_chkSelectAll
4.0 id=grdUserEntity_ctl01_chkSelectAll
根据我读到的配置设置将导致 ASP.Net 4.0 呈现服务器控件和客户端 ID 与以前的版本相同。
我们做错了什么?