Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Input

Status
Not open for further replies.

paakay

Programmer
Aug 23, 2005
7
My form seems to be unstable. The reason is that even if I enter certain values that are within the value range the range validator seem to catch them.Below is my code
<tr>
<td style="height: 8px; width: 104px">
Rent(Monthly):</td>
<td style="height: 8px; width: 228px;">
<asp:TextBox ID="rentTextBox" runat="server" Width="100px" MaxLength="5">$</asp:TextBox>
<asp:RequiredFieldValidator ID="rentReqdFldValidator" runat="server"
ControlToValidate="rentTextBox" ErrorMessage="Enter monthly rent">*</asp:RequiredFieldValidator>
<cc1:ValidatorCalloutExtender ID="rentReqdFldValidator_ValidatorCalloutExtender"
runat="server" Enabled="True" TargetControlID="rentReqdFldValidator">
</cc1:ValidatorCalloutExtender>
<asp:RangeValidator ID="rentRangeValidator1" runat="server"
ControlToValidate="rentTextBox" ErrorMessage="Enter rent between $100 & $2500"
MaximumValue="$2500" MinimumValue="$100" Type="String">*</asp:RangeValidator>

</td>
</tr>
Any help will be much appreciated
 
the $ symbol is probably the problem. $ is formatting. to validate a number you don't need the formatting, just the data.
Code:
$<asp:TextBox ID="rentTextBox" runat="server" Width="100px" MaxLength="5" />
<asp:RangeValidator ID="rentRangeValidator1" runat="server" ControlToValidate="rentTextBox" ErrorMessage="Enter rent between $100 & $2500" MaximumValue="2500" MinimumValue="100" Type="String" Text="*" />

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
See if this fixes it for you.
Code:
<asp:RangeValidator ID="rentRangeValidator1" runat="server" ControlToValidate="rentTextBox" ErrorMessage="Enter rent between $100 & $2500" MaximumValue="2500" MinimumValue="100" Type="Currency">*</asp:RangeValidator>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top