[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

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

Posted on 2008-01-28
4
Medium Priority
?
262 Views
Last Modified: 2013-11-26
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
0
Comment
Question by:runbird
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
Bane83 earned 200 total points
ID: 20765635
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
 
LVL 10

Expert Comment

by:Bane83
ID: 20765638
Note that if you do not need the textbox to always contain a value, then you don't need the RequiredFieldValidator.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21198223
Forced accept.

Computer101
EE Admin
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question