Quick Start > Step 4 of 5: Add a Culture Setting |
This topic demonstrates how to add code to Button_Click events to set the Culture for the C1InputDate and C1InputCurrency controls. To do this, complete the following steps:
Button1 Properties: | Button2 Properties: |
---|---|
(ID) = FrenchBtn | (ID) = USEnglishBtn |
Text = French Culture | Text = U.S. English Culture |
Height = 25px | Height = 25px |
Width = 130px | Width = 140px |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Protected Sub FrenchBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles FrenchBtn.Click C1InputDate1.Culture = New System.Globalization.CultureInfo("fr-FR") C1InputCurrency1.Culture = New System.Globalization.CultureInfo("fr-FR") End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
protected void FrenchBtn_Click(object sender, System.EventArgs e) { C1InputDate1.Culture = new System.Globalization.CultureInfo("fr-FR"); C1InputCurrency1.Culture = new System.Globalization.CultureInfo("fr-FR"); } |
The next topic shows how to run the application. It also lists tasks for you to complete to observe the functionality of the Web form.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Protected Sub USEnglishBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles USEnglishBtn.Click C1InputDate1.Culture = New System.Globalization.CultureInfo("en-US") C1InputCurrency1.Culture = New System.Globalization.CultureInfo("en-US") End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
protected void USEnglishBtn_Click(object sender, System.EventArgs e) { C1InputDate1.Culture = new System.Globalization.CultureInfo("en-US"); C1InputCurrency1.Culture = new System.Globalization.CultureInfo("en-US"); } |
You have successfully added two button controls with culture information to your Web form. The following image shows the appearance of the updated Web form:
The next topic shows how to run the application. It also lists tasks for you to complete to observe the functionality of the Web form.