Reputation: 15303
After upgrading an asp.net web forms application from the 2.0 framework to the 4.0 framework it appears references like the following are broken in javascript
document.RF_Login.hidSubmit.value="Yes";
It results in the following error:
Why does this occur when upgrading to the 4.0 framework? Is there something I can do to not have to update all references like this in the entire website?
The name of the page is RF_Login.aspx and inside the page the following exists:
<FORM id="RF_Login" method="post" runat="server">
Upvotes: 1
Views: 949
Reputation: 5596
I believe the issue is due to .NET 2.0 using AutoID for the .NET control ID generation. Whereas, .NET 4.0+ uses the predictable clientId mode.
As taken from: .NET Framework 4 Migration Issues
The new clientIDMode setting in ASP.NET 4 lets you specify how ASP.NET generates the id attribute for HTML elements. In previous versions of ASP.NET, the default behavior was equivalent to the AutoID setting of clientIDMode. The default setting is now Predictable.
Resolution:
To disable the new client ID mode, add the following setting to the Web.config file:
<pages clientIDMode="AutoID" />
or
<pages controlRenderingCompatibilityVersion="3.5" />
Or both combined:
<pages clientIDMode="AutoID" controlRenderingCompatibilityVersion="3.5" />
Upvotes: 1