8
Contributors
8
Replies
10
Views
10 Years
Discussion Span
Last Post by nil
0

hi,

To validate the numeric in the TextBox use
:-/

RegularExpressionValidator control
In Properties

Specify the control which control to validate in ControlToValidate Property.

In Text Property Specify any Error Message.


regards
:icon_lol: shailu

0

how to make a validation like vb in asp.net? I want to make a text box should only accept numeric values....

samy

friend may i know what language you are using
you want tovalidate that on client side or server side

0

hi,

Its a server side validation control, this control can be used in VB or C# and one more thing u have to mainly specify the Validation Expression in the control property.

Numeric Validation : \d {3,5} -----> d -Numeric Checking, {} - Size
Character Validation : \D {5,10} -----> D - Character Validation, {} - Size.

Regards
Shailu.:icon_smile:

0

If the intention is only to make the textbox accept only numeric values, just very simply use the Isnumeric function.

that is

if not Isnumeric(textbox.text) then
 'do stuff like forcing retyping of content
end if

Hope this helps.

0

how to make a validation like vb in asp.net? I want to make a text box should only accept numeric values....

samy

Hi,
First of all you need validation for textbox and you want user to enter only numeric values. So rather than allowing user to enter something and check it whether it is numeric or not is not good approach. I believe prevention is better than cure.

So you can Use FilterTextboxExtender that comes with AjaxToolkit. Please have a look at this demo

I hope this will solve your problem. You can use other tools also, they are very useful.

Happy Programming!! :icon_smile:

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.