Click here to Skip to main content
15,902,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have face different culture problem in my application. For example, I have configured my application in IIS7 and set the language chines in browser. The chines culture is set When run the application in server. I will go to change language german in my local browser. I will see my application in local browser which culture is not applied.

how to set different culture in IIS7?

Thanks in advance

Rameshkumar.T
Posted
Updated 8-Nov-10 17:17pm
v2

1 solution

Hi All,

I got solution to show the number format in different culture.
Changes in Web.Config:
XML
<globalization enableClientBasedCulture="true" culture="de-DE" uiCulture="auto"/>


1. culture=de-DE will set the language in which the Database will fetch the records, for e.g: if Database is of “de-DE” language then culture should be in de-DE.
2. uiCulture=auto will consider the language set in Clients browser for User Interface.
C#
protected void Page_Init(object sender, EventArgs e)
{
    System.Globalization.CultureInfo pageCultureInfo = System.Globalization.CultureInfo.CurrentCulture;
    Page.Culture = pageCultureInfo.Name.ToString();
}

New Code: [Current Browser Culture will be set to Page UICulture]
protected void Page_Init(object sender, EventArgs e)
{
    System.Globalization.CultureInfo pageCultureInfo = new CultureInfo(ApplicationConstants.RegionalSettings, false);
    Page.UICulture = pageCultureInfo.Name.ToString();
}


Solution Status:
The Property Data type of in Class will be same as the Table field Data type
1. For Price and Weight fields
a)If data type of property is string the format is applied perfectly
b) If data type of property is double the formatting has problem
drOrder['Purchase_Price'] value is set to 1,50 in database
double dblPrice = Convert.ToDouble(drOrder['Purchase_Price'])
dblPrice shows 1.50
dblPrice.ToString() shows 1,50
when binding to coolite grid it displays 1.50 instead of 1,50
checked with forums http://msdn.microsoft.com/en-us/library/system.convert.todouble(VS.71).aspx
 
Share this answer
 
v3
Comments
Ankur\m/ 20-Nov-10 0:10am    
Minor edit for proper code formatting.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900