Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 4th, 2004, 08:19 PM
Authorized User
Join Date: Jun 2003
Location: Norwalk, CA, USA.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Validation of TextBox Input

I need to validate the input to TextBox. Values allowed are either 0.00 or bteween 0-9. I wrote follwing function:
private bool isNumeric(string val)
    foreach (char c in val.ToCharArray())
    if (!Char.IsDigit(c))
    return false; }
    return true;

but this does not accept 0.00 as numeric value or it does not accept . as numeric value. What is the best solution? I am not well versed with JavaScript.

Tank you
Bharat Gadhia

Oh - once in your life you find someone
Who will turn your world around
Bring you up when you're feelin' down

From: Bryan Adams

Bharat Gadhia
Bharat Gadhia
  #2 (permalink)  
Old March 16th, 2004, 05:07 PM
Registered User
Join Date: Mar 2004
Location: Ashburn, VA, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

May I suggest using an ASP.NET Range Validator?

Here is an example:

<asp:RangeValidator Type=Double MinimumValue=0.0 MaximumValue=9.0 ControlToValidate="CONTROL ID" Runat=server />

Jason A. Greenfeld, MCSD
Sr. Software Developer
STG, Inc.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Input Validation sams ASP.NET 2.0 Professional 4 June 12th, 2007 03:29 AM
Validation to input fields amol_0008 XML 1 May 30th, 2007 04:36 AM
Input validation in JFormattedTextField harini19 Java Basics 2 November 14th, 2006 01:50 AM
Input validation shs BOOK: Beginning ASP.NET 1.0 14 January 6th, 2005 01:03 PM
Input Validation Maxood C++ Programming 11 August 6th, 2004 02:55 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.