asp.net.ph

Page.Culture Property

System.Web.UI Namespace   Page Class


Gets or sets the culture name for the Thread object associated with the page.

[ VB ]
Public Property Culture As String

[ C# ]
public string Culture { get; set; }

[ C++ ]
public:
property String^ Culture {
   String^ get ( );
   void set ( String^ value );
}

[ JScript ]
public function get Culture ( ) : String

public function set Culture ( value : String )

Property Value

A valid culture name.

Remarks

The Culture property is used to help localize page content. The Culture value determines the results of culture-dependent functions, such as the date, number, and currency formatting.

NOTE: The Culture value can be set to specific cultures only, such as en-US or en-GB. This prevents the requirement to identify the correct currency symbol to use for en, where en-US and en-GB have different currency symbols.

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-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 Culture attribute can be set in the @ Page directive in the .aspx file. This applies the setting only to the page.

<%@ Page Language="C#" Culture="auto" UICulture="auto" %>

In addition, the value of the Culture 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>

Example

The following example illustrates how to programmatically set the Culture property to localize page content.

 Show me 

See Also

Page Members   Page.UICulture Property   Page.LCID Property Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph