Completed
Last Updated: 31 Oct 2016 13:28 by ADMIN
ADMIN
Ralitsa
Created on: 13 May 2016 08:18
Category: Editors
Type: Bug Report
0
IMPROVE. RadMaskedEditBox - the value of numeric mask is reset when switching between different cultures
Steps to reproduce: 
public Form1()
{
    InitializeComponent();
    this.Text = Telerik.WinControls.VersionNumber.Number;
    this.radMaskedEditBox1.Culture = new System.Globalization.CultureInfo("nl-BE");
    this.radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Numeric;
    this.radMaskedEditBox1.Mask = "C";
    this.radMaskedEditBox1.Value = 570.00;
}

private void radButton2_Click(object sender, EventArgs e)
{      
    this.radMaskedEditBox1.Culture = new System.Globalization.CultureInfo("en-US"); 
}

private void radButton1_Click(object sender, EventArgs e)
{
    this.radMaskedEditBox1.Culture = new System.Globalization.CultureInfo("nl-BE");
}

Run the application and change the culture between Dutch and English, you will see that the value is reset instead keep it.

Workaround: 
CultureInfo providerDutch = new CultureInfo("nl-BE");
CultureInfo providerEnglish = new CultureInfo("en-US");

public Form1()
{
    InitializeComponent();
    this.Text = Telerik.WinControls.VersionNumber.Number;

    this.radMaskedEditBox1.Culture = providerDutch;
    this.radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Numeric;
    this.radMaskedEditBox1.Mask = "C";
    this.radMaskedEditBox1.Value = 570.00;
}

private void radButton1_Click(object sender, EventArgs e)
{
    double tempValue = double.Parse(this.radMaskedEditBox1.Value.ToString(), NumberStyles.Currency | NumberStyles.AllowThousands | NumberStyles.AllowDecimalPoint, providerEnglish); 
    this.radMaskedEditBox1.Culture = new System.Globalization.CultureInfo("nl-BE");
    this.radMaskedEditBox1.Value = tempValue;
}

private void radButton2_Click(object sender, EventArgs e)
{
    double tempValue = double.Parse(this.radMaskedEditBox1.Value.ToString(), NumberStyles.Currency | NumberStyles.AllowThousands | NumberStyles.AllowDecimalPoint, providerDutch); 
    this.radMaskedEditBox1.Culture = new System.Globalization.CultureInfo("en-US");
    this.radMaskedEditBox1.Value = tempValue;
}
0 comments