System.Web.UI Namespace Page Class
Gets or sets the user interface (UI) culture name for the Thread object associated with the page.
[ VB ]
Public Property UICulture As String
[ C# ]
public string UICulture { get; set; }
[ C++ ]
public:
property String^ UICulture {
String^ get ( );
void set ( String^ value );
}
[ JScript ]
public function get UICulture ( ) : String
public function set UICulture ( value : String )
The user interface culture name.
The UICulture property is used to help localize page content. The UICulture value determines which localization resources are loaded for the page.
The property can be set to any valid culture name. For example, the en-US culture name sets the page to American English, while the fr culture name sets the page to French.
The value can also be set to auto which performs automatic detection of the browser's preferred language. The automatic language detection can be qualified with a default value such as auto:en-US.
The UICulture attribute can be set in the @ Page directive in the .aspx
file. When the page is requested, the dynamically generated class sets the value of this property.
<%@ Page Language="C#" Culture="auto" UICulture="auto" %>
In addition, the value of the UICulture property can also be set programmatically
string selectedLanguage = Request.Form [ "lstLanguages" ];
Culture = selectedLanguage;
UICulture = selectedLanguage;
or in the globalization element of the Web.config
file. This applies the setting to all pages within the scope of the Web.config
file.
<configuration>
<system.web>
<globalization
requestEncoding = "us-ascii"
responseEncoding = "iso-8859-1"
culture = "fr-FR"
uiculture = "fr" />
</system.web>
</configuration>
The following example illustrates how to programmatically set the UICulture property to localize page content.
Show me
Page Members Page.Culture Property Page.LCID Property