Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top