Does ASP.NET always apply the "ct100$..." prefixes to element IDs, or in some cases does it optimize this away if the element is guaranteed unique anyways.
Recently I have seen builds differing in the ID prefixes being applied, one having the prefixes and one not but both deriving from the same source.
Can anyone provide any more detail this, and o开发者_如何学Gon the workings of INamingContainers and ID generation?
The new ASP.NET 4 ClientIDMode property affects the client-side ID rendered. Setting the naming container control to Predictive is meant to cut down on this... Static takes the exact ID and renders to the client, which you have to be careful to ensure uniqueness.
When you use a naming container (a master page is also a naming container), it appends this longer ID to ensure uniqueness; with .NET 4, they thought a little more about this and added features like Predictive and Static to cut down on the lengths of the IDs.
HTH.
精彩评论