views:

163

answers:

1

We have just updated our application from ASP.Net 2.0 to ASP.Net 4.0.

We have included in the web.config in the system.web element:

<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />

My understanding is that this is supposed to render the controls the same as .Net 2.0/3.5 would.

However... its not... here is one example?

This in 2.0:

<input id="grdUserEntity__ctl1_chkSelectAll" type="checkbox" name="grdUserEntity:_ctl1:chkSelectAll" onclick="javascript:iSelectAll();" />

This in 4.0:

<input id="grdUserEntity_ctl01_chkSelectAll" type="checkbox" name="grdUserEntity$ctl01$chkSelectAll" onclick="javascript:iSelectAll();" />

So..

2.0 ID=grdUserEntity__ctl1_chkSelectAll
4.0 ID=grdUserEntity_ctl01_chkSelectAll

According to what I read that config setting will cause ASP.Net 4.0 to render the server controls and client id's identically to the previous version. What are we doing wrong?

+1  A: 

There was a change to how IDs were rendered from ASP.NET 2.0 to ASP.NET 3.5. Since you're going from 2.0 to 4.0, you're still seeing that difference. The change was due to XHTML compliance improvements.

You can try switching back to the 2.0 rendering with the xhtmlCompliance compat setting. Yet another compat setting, yes :) It should work, but honestly, I'm not sure how well tested that old compat setting is in 4.0, and I know it wouldn't be compatible with the UpdatePanel, if you were planning on using that.

Is there a reason why you want to keep the 2.0 rendering? Just fear of regressions, or do you have any known actual regressions?

XHTML setting: http://msdn.microsoft.com/en-us/library/ms178159.aspx

InfinitiesLoop
We have javascript that is based on the way 2.0 renders. So, yes we have several regression issues now.
PilotBob
Yes... this resolves the regression. Thanks mucho.
PilotBob
Great! Good to hear.
InfinitiesLoop