Any Function for testing a int Type? (.net)

  • Thread starter Thread starter fatboycanteen
  • Start date Start date
F

fatboycanteen

I have a texbox
when user enter a value
and submit
I want to check the input value is integer or not
any method provide asp.net! (vb language)
Thank You
 
fatboycanteen said:
I have a texbox
when user enter a value
and submit
I want to check the input value is integer or not
any method provide asp.net! (vb language)
Thank You

Use a CompareValidator:
- set the ControlToValidate property to the textbox you want to validate
- set the Operator property to DataTypeCheck
- set the Type property to Integer
- don't forget to set the ErrorMessage text

Note 1: an empty textbox still satisfies the CompareValidator (add a
RequiredFieldValidator to prevent this)
Note 2: the value returned from the textbox is still a "text", so you need
an Int32.Parse() to convert to a real integer

Hans Kesting
 
-----Original Message-----



Use a CompareValidator:
- set the ControlToValidate property to the textbox you want to validate
- set the Operator property to DataTypeCheck
- set the Type property to Integer
- don't forget to set the ErrorMessage text

Note 1: an empty textbox still satisfies the CompareValidator (add a
RequiredFieldValidator to prevent this)
Note 2: the value returned from the textbox is still a "text", so you need
an Int32.Parse() to convert to a real integer

Hans Kesting


.
 
To test client-side write javascript and check characters in the string.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top