Dear All,
i am trying to create form as amount inputter, using RadNumericText and CompareValidator (to compare min max value between RadNumeric) through code behind. CompareValidator work perfectly where value of RadNumeric doesn't contain digit behind commas (attached images : data no 1), but, when i'm inputted value with commas, it's doesn't working as expected, as shown in the attached images.
No City Min Max
1 Aceh $ 100.001,00 $ 100.000,00
*Amount min cannot be greater than amount max
2. Yogya $ 100.000,00 $ 100.000,00
3. Banten $ 100.000,88 $ 100.000,99
*Amount min cannot be greater than amount max
From data above, no 1, CompareValidator working perfectly, but not for data no 3, where value has any digit behind commas. Any advice how to compare min max value with commas at data no 3 ?
Regard,
Ragil
protected
RadNumericTextBox mytextbox;
public
void
InstantiateIn(System.Web.UI.Control container)
{
mytextbox =
new
RadNumericTextBox();
mytextbox.AutoPostBack =
false
;
mytextbox.ID = rankName + typeName +
"MyTextBox"
;
mytextbox.NumberFormat.DecimalDigits = 2;
mytextbox.NumberFormat.GroupSeparator =
"."
;
mytextbox.NumberFormat.DecimalSeparator =
","
;
mytextbox.Type = NumericType.Currency;
//mytextbox.DataType = "System.Decimal";
reqValid =
new
RequiredFieldValidator();
reqValid.ForeColor = System.Drawing.Color.Red;
reqValid.ErrorMessage =
"* Required field"
;
reqValid.CssClass =
"has-error"
;
reqValid.ControlToValidate = rankName + typeName +
"MyTextBox"
;
reqValid.Display = ValidatorDisplay.Dynamic;
if
(typeName ==
"Max"
)
{
compValid =
new
CompareValidator();
compValid.ForeColor = System.Drawing.Color.Red;
compValid.ErrorMessage =
"* Amount Min can not be greater than Amount Max"
;
compValid.CssClass =
"has-error"
;
compValid.Display = ValidatorDisplay.Dynamic;
compValid.ControlToValidate = rankName +
"Max"
+
"MyTextBox"
;
compValid.ControlToCompare = rankName +
"Min"
+
"MyTextBox"
;
compValid.Operator = ValidationCompareOperator.GreaterThanEqual;
compValid.Type = ValidationDataType.Currency;
compValid.ValidationGroup =
"ValidateAmount"
;
}
container.Controls.Add(mytextbox);
container.Controls.Add(reqValid);
if
(typeName ==
"Max"
)
{
container.Controls.Add(compValid);
}
}