Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 text / number format

Author  Topic 

teedah1
Starting Member

10 Posts

Posted - 2007-07-25 : 11:23:32
i have a form and has a form field where people type in numbers to search by. the SQL column is an intergers colum.
in order to prevent users from putting in text instead of numbers, how do i create an error message to tell the user to put in numbers instead?

thanks.

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-07-25 : 11:41:27
Use the validation controls provided by asp.net.



- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

teedah1
Starting Member

10 Posts

Posted - 2007-07-25 : 11:59:56
i had set it to "causesValidation" is true, nothing happens. still getting error message saying mismatch format.

Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2007-07-26 : 07:50:38
you need to place a validatior on the page, and have it pointed to your text box, and have it check your text box for numeric input.

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-07-26 : 09:31:53
If you are not sure how asp.net validation works, close and save the form you are working on. Close the entire application and create or open up a test area. Add a form. Add some text boxes. Add some validation controls. Experiment. Always, always practice and learn new techniques AWAY from the actual code you are working on, so you can really isolate and play with it and get a feel for it. Then, when you feel good, go back to your code.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -