docs.Microsoft.com says that moving from .NET 3.5 to .NET 4.0 (or greater) causes this breaking change that changes the way that the id
attribute for elements is generated.
In the web.config file, change the <pages>
element, add the clientIDMode
attribute to it like this:
<pages clientIDMode="AutoID" ...
This should continue making IDs in the way that it did before.
In addition to AutoID
, MSDN lists several other useful options:
- AutoID - Auto-generate the segments with the underscore character
- Inherit - Inherit the mode from the parent container
- Predictable - Default value for a page in .NET 4.0 and up
- Static - ClientID is set to the value of the ID property
Visual Studio is supposed to set the ClientIDMode
to AutoID
when you upgrade from .NET 3.5 to .NET 4.5, however I don't think it works when you do not have a ASP.Net Web Project (.csproj) and instead all you have is a ASP.NET Website.