tags:

views:

20

answers:

3

I have a currency textbox , where the currency is in french language (using ',' instead of ',' and vice versa)

I added MaskedEditExtender but automatically it translated the '.' into a space! Here you are the code:

MaskedEditExtender oMaskedEditExtender = new MaskedEditExtender();
oMaskedEditExtender.ID = "MEE" + txtMoney.ID;
oMaskedEditExtender.TargetControlID = txtMoney.ID;
oMaskedEditExtender.MaskType = MaskedEditType.Number;
oMaskedEditExtender.Mask = "9.999.999.999,99";
oMaskedEditExtender.InputDirection = MaskedEditInputDirection.RightToLeft;
Page.Controls.Add(oMaskedEditExtender);

please inform me if there is another solution for filtering the TextBox for only the french currency

A: 

The MaskedEditExtender has a property called CultureName. Quote from the documentation:

Name of culture to use (overrides the default page culture)

Didn't use it myself, but it definitely sounds like what you are looking for. Try to set it to "fr-FR" and see what happens.

Fredrik Mörk
I used it but .. the same problem! cause the MaskedEditExtender has a french culture but the textbox has english culture. This is an example :My entry test value is : 0.007.600.000,00After the mask, it'll be : 07,600,000 00As we can see the text box consider it as a fraction
abdelrahman ELGAMAL
A: 

I forced it by using the backslach before the special characters like that:

oMaskedEditExtender.Mask = @"9.999.999.999\,99";

abdelrahman ELGAMAL
A: 

The best way to filter the output text is conclused in two points :-

1- myTextBox.Text = string.Format(System.Globalization.CultureInfo.GetCultureInfo("fr-FR"), "{0:c0}", _value);

Where, _value is a number with any format, then it will be formated in a french cyrrency format

2- Adding the MaskedEditExtender object with the next mask : MaskedEditExtender.Mask = @"9,999,999,999.99";

abdelrahman ELGAMAL