I am using a custom validator to compare value in two text box. This is comparing the values fine. But it says ‘025’ and ’25’ are different.. can this do a float comparision.
the custom validator i am using is
<asp:CompareValidator id='compval' runat='server' ControlToValidate='txtBox1' ErrorMessage='There values are not equal.' Enabled='False' ControlToCompare='txtBox2'>*</asp:CompareValidator></TD>
Please let me know if this is possible.
Use System.Double.Parse(value) to convert both to a floating point number, and compare those numbers.
You can also use TryParse if you don’t want to handle exceptions if the value is not a valid floating point number.
See also: