About
Pricing
Community
Teams
Start Free Trial
Log in
Wigging
asked on
5/13/2011
validate currency
If CityName.Text > coprice.Text Then
cityname= 5
coprice=25.99
i keep getting error that CityName.Text is greater but it isnt????
ASP.NET
6
1
Last Comment
Alfred A.
8/22/2022 - Mon
Randy Downs
5/13/2011
try this -
http://forums.asp.net/t/1130001.aspx/1
or this -
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.comparevalidator_members(VS.80).aspx
plusone3055
5/13/2011
if Cstr(CityName.Text) > cstr(coprice.Text) then
Randy Downs
5/13/2011
something like this maybe
<asp:TextBox id="TextBox1" runat="server" />
<asp:RequiredFieldValidato
r id="RVF1" runat="server" ControlToValidate="TextBox
1"
ErrorMessage="Required" Display="Dynamic" />
<asp:CompareValidator id="CheckFormat1" runat="server" ControlToValidate="TextBox
1" Operator="DataTypeCheck"
Type="Currency" Display="Dynamic" ErrorMessage="Illegal format for currency" />
<asp:RangeValidator id="RangeCheck1" runat="server" ControlToValidate="TextBox
1"
Type="Currency" Minimum="1.00" Maximum="999.99" ErrorMessage="Out of range" Display="Dynamic" />
Your help has saved me hundreds of hours of internet surfing.
fblack61
Rick
5/13/2011
Because you want to compare numbers, not text, use this:
if cdbl(CityName.Text) > cdbl(coprice) then
Rick
5/13/2011
Forgot the text attribute:
if cdbl(CityName.Text) > cdbl(coprice
.text
) then
ASKER CERTIFIED SOLUTION
Alfred A.
5/13/2011
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
or this - http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.comparevalidator_members(VS.80).aspx