How am I going to do with the TextBox validation in my WebForm?

Hi,

I am doing the Webform development. And I am using ASP.NET in VB & .NET Framework 1.1
May I know how to do the number validation on my TextBox control?

Thanks & Regards,
Chung Ee
runbirdAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bane83Commented:
If the textbox MUST have a value, you will need a required field validator and a compare validator:

<asp:RequiredFieldValidator ID="MyRequiredFieldValidator" runat="server" ControlToValidate="MyTextBoxID" ErrorMessage="Please specify a value"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="MyCompareValidator" runat="server" ControlToValidate="MyTextBoxID" ErrorMessage="The value entered is not of type XYZ" Operator="DataTypeCheck" Type="Integer"></asp:CompareValidator>

You can also use double instead of Integer if you require a decimal value.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bane83Commented:
Note that if you do not need the textbox to always contain a value, then you don't need the RequiredFieldValidator.
0
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.