Question

I've created a simple ASP.NET 4.0 application to see how rendered client ids will vary if I change controlRenderingCompatibilityVersion in web.config and ClientIDMode attribute of the control. Now I've set <pages controlRenderingCompatibilityVersion="3.5"/> and <asp:Label runat="server" ID="Message" ClientIDMode="AutoID" /> and expect to find in the generated markup asp.net-3.5-style ClientID (something like id='ctl00_Message'), but I see this <span id="Message">Hello world!</span>.

Why does not ASP.NET render it as a 3.5-style id?

Was it helpful?

Solution

If the span is on it's own, then there is no reason to change the ID.

It depends if the control is inside another control. If the span above is inside a Repeater, DataList etc, then the Id will change.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top