Reputation: 487
i have a simple code composed of add edit delete. I have a name,description and price value fields. i want to have a range on the price value ranging from 1 - 10. though i have this on my code:
<td class="style7">
<asp:RangeValidator ID="RangeValidator2" runat="server"
ControlToValidate="TextBox3" ErrorMessage="1-10" MaximumValue="10"
MinimumValue="1"></asp:RangeValidator>
</td>
when i try to click on add, although its within the range of 1-10, its not adding up. any tricks on this? thank you!
Upvotes: 1
Views: 46
Reputation: 4236
You should definitely add Type="Integer" property (or any other type which fits your needs). What is happening now is that your RangeValidator Type is set to String as a default. The comparison occurs for strings which leads to the value string being required to be between "1" and "10".
See this example from MSDN documentation.
Upvotes: 0