ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Validating to make shure they enter numbers

 
Post new topic   Reply to topic    ASPdev.org Forum Index -> .NET Programming (ASP.NET, VB.NET, C#)
View previous topic :: View next topic  
Author Message
Tobias



Joined: 03 Aug 2005
Posts: 1
Location: Sweden

PostPosted: Wed Aug 03, 2005 2:46 am    Post subject: Validating to make shure they enter numbers Reply with quote

Hi!

I have two inputs in a ASP page which should be answered with numbers. How do I validate to make shure they post the form with numbers?
Back to top
View user's profile Send private message
administrator
Site Admin


Joined: 01 Oct 2004
Posts: 183

PostPosted: Wed Aug 03, 2005 7:21 am    Post subject: Reply with quote

You can use the RangeValidator ASP.NET control. The example below will ensure that the entry in the txtNumber field is an integer number between 1 and 93:

Code:


<asp:TextBox id="txtNumber" runat="server"></asp:TextBox>

<asp:RangeValidator id="RangeValidator1" runat="server"
ControlToValidate="txtNumber" Type="Integer"
ErrorMessage="Enter integer number between 1 and 93"
MinimumValue="1" MaximumValue="93"></asp:RangeValidator>


_________________
Peter
ASP & ASP.NET Articles and Tutorials
Back to top
View user's profile Send private message
twinkle



Joined: 31 Jan 2006
Posts: 79

PostPosted: Tue Jan 31, 2006 9:24 pm    Post subject: Reply with quote

How about if you wanted to do something similar but wanted to limit it to proper date format?
_________________
I shine
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> .NET Programming (ASP.NET, VB.NET, C#) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group

SQL Tutorial