Select CultureAuto : CultureInfo « I18N « ASP.NET Tutorial






In the <%@ Page %> directive, both the Culture and UICulture attributes are set to the value auto:en-US. 

The culture name that appears after the colon enables you to specify a default culture when a language preference cannot be detected from the browser.


<%@ Page Language="C#" Culture="auto:en-US" UICulture="auto:en-US"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
    void Page_PreRender()
    {
        lblDate.Text = DateTime.Now.ToString("D");
        lblPrice.Text = (512.33m).ToString("c");
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Select Culture Auto</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    Today's date is:
    <br />
    <asp:Label
        id="lblDate"
        Runat="server" />

    <br /><br />
    The price of the product is:
    <br />
    <asp:Label
        id="lblPrice"
        Runat="server" />

    </div>
    </form>
</body>
</html>








22.1.CultureInfo
22.1.1.Create CultureInfo
22.1.2.Selecting a culture from a DropDownList control.
22.1.3.Use Profile object to store a user's preferred culture
22.1.4.Using the CultureInfo Class to Format String Values
22.1.5.Select CultureAuto
22.1.6.Choose culture control