Gets a value that specifies the ASP.NET version that rendered HTML will be compatible with.
Assembly: System.Web (in System.Web.dll)
[<BindableAttribute(false)>] [<BrowsableAttribute(false)>] abstract RenderingCompatibility : Version with get, set [<BindableAttribute(false)>] [<BrowsableAttribute(false)>] override RenderingCompatibility : Version with get, set
Property ValueType: System.Version
The ASP.NET version that rendered HTML will be compatible with.
ASP.NET sets this property to the value of the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file. If the controlRenderingCompatibilityVersion attribute is not set in the Web.config file, the default value is the current version of ASP.NET.
There is a public set accessor for this property, but the set accessor supports the .NET Framework infrastructure and is not intended to be used directly from your code. If you set this value in your code, the effect is unpredictable.
Each release of ASP.NET might render HTML differently from earlier releases. For example, in ASP.NET 3.5, if the IsEnabled property of a Label control is false, by default, ASP.NET renders a span element whose disabled attribute is set to "disabled". In ASP.NET 4, by default, the span element is rendered with a cascading style sheet (CSS) class attribute instead of the disabled attribute. This lets you specify the disabled appearance of the control and avoids rendering invalid HTML. (In HTML 4.0 and XHTML 1.1, the span element does not support the disabled attribute.)
A Web application might include code that would not function correctly if HTML rendering changes. To avoid this problem, you can set the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file to indicate which earlier version you want to maintain compatibility with. For example, if you set the property to 3.5, a disabled Label control will render a disabled attribute and not a CSS class.
The earliest version that you can set this property to is 3.5.
To maintain backward compatibility, when you use Visual Studio to upgrade a Web project to ASP.NET 4 from an earlier version, Visual Studio automatically sets the controlRenderingCompatibilityVersion attribute in the Web.config file to 3.5. If you want an upgraded Web site to render HTML using the algorithm that was introduced in ASP.NET 4, you can change or remove the controlRenderingCompatibilityVersion attribute.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.