SWAMY YT

SWAMY YT

  • 1.1k
  • 643
  • 30.3k

compare validation in asp.net for negative numbers

Aug 16 2018 6:58 AM
Dear sir,
 
I am getting an issue with the compare validatr i.e for  negative values i have a condition that is the second control text field shoudn't exceeding the value, it should be always less than or equal to first field. 
it is working fine for the positive values  but for negative values the condition is not satisfied.
the problem is like a scenario that is if first field is -22  and the second control field  should less than -22 i.e  -22, -23,-24,---- so on.
but i my cndition for negative values also my machine treated the values as positive numbers.
any soution,
thank you in a dvance 
 
here is my code , 
 
<tr runat="server">
<td class="auto-style181" style="border:1px solid black;border-collapse:collapse;font-family:Calibri;text-align:left; font-size: 12px">Dry Bulb<span style="color:red">*</span></td>
<td class="auto-style95" style="border:1px solid black;border-collapse:collapse;text-align:left;font-family:Calibri; font-size: 12px">
<asp:TextBox ID="Db2" runat="server" Width="58px" ValidationGroup="ResetTextFields"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator2" Display="Dynamic" runat="server" ErrorMessage="should between(-28 to +52) c" ValidationGroup="ResetTextFields" ControlToValidate="Db2" ForeColor="Red" MaximumValue="52" MinimumValue="-28" type="double"></asp:RangeValidator>
<asp:RequiredFieldValidator ID="RqdtxtDryBulb" Display="Dynamic" ControlToValidate="Db2" runat="server" ValidationGroup="ResetTextFields" ErrorMessage ="DryBulb Value Required" ForeColor="Red" Text="*"></asp:RequiredFieldValidator>
</td>
<td style="border:1px solid black;border-collapse:collapse;text-align:center; font-size: 12px" class="auto-style105"><sup>o</sup>C</td>
</tr>
<tr runat="server">
<td class="auto-style181" style="border:1px solid black;border-collapse:collapse;font-family:Calibri;text-align:left; font-size: 12px">Wet Bulb<span style="color:red">*</span></td>
<td class="auto-style95" style="border:1px solid black;border-collapse:collapse;text-align:center;text-align:left;font-family:Calibri; font-size: 12px">
<asp:TextBox ID="Wb2" runat="server" Width="58px" ValidationGroup="ResetTextFields" CausesValidation="True"></asp:TextBox>
<asp:RequiredFieldValidator ID="RqdWetBulb" display="Dynamic" ValidationGroup="ResetTextFields" runat="server" ControlToValidate="Wb2" Text="*" ForeColor="Red" ErrorMessage="Please Enter Wetbulb"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CmptxtWetBulb" Display="Dynamic" ValidationGroup="ResetTextFields" ControlToValidate="Db2" runat="server" ControlToCompare="Wb2" Operator="GreaterThanEqual" ErrorMessage="WetBulb Value should less or Equal to DryBulb" ForeColor="Red"></asp:CompareValidator>
</td>
<td style="border:1px solid black;border-collapse:collapse;text-align:center;font-family:Calibri; font-size: 12px" class="auto-style105"><sup>o</sup>C</td>
</tr>
 
 

Answers (1)