Click here to Skip to main content
Licence CPOL
First Posted 13 Feb 2006
Views 56,715
Bookmarked 36 times

NumericInput

By | 8 Mar 2006 | Article
A numeric input control.

Introduction

This code drop is part of a smash and grab series. If you're in a rush, you can just grab this code and insert it into your application, no understanding is required. When you have some time, you can review the source code.

Background

I was presented with a project to convert an Access single-user application into a web-based multi-user SQL Server application. The Access application had a number of numeric input boxes. I couldn't find what I needed anywhere on the net. So, I had to find a solution myself.

Using the code

  • Download the project, unzip it to somewhere on your hard disk.
  • Create a new ASP.NET project.
  • Select Tools > Choose toolbox items.
  • Navigate to the unzip folder and select the DLL.
  • The new server control now appears in the toolbox under General.
  • Drag an instance of it onto Default.aspx.

Now, set these properties on the NumericInput:

  • NumericFormat: Integer, Float or Currency.
  • DecimalSeparator: If left blank, the current culture's default is used (usually '.' or ','). To override, enter '.' , ',' or any other character (don't include the quotes).

Points of interest

The control also works with data binding for use in GridView, etc. The control extracts the JavaScript from the DLL using WebResource. Search CodeProject for the keywords webresource redux for details on this subject.

SmashGrab / Redux series

I have recently started two series of articles here at CodeProject. Smash and Grab is intended as a series of short articles on one specific code technique. Redux is intended as a series of longer articles which attempts to reduce a complicated topic (like GridView) into its basic constituent parts and shows that once you have all the information, it isn't really that hard. To find the Smash and Grab articles, search for the keyword SmashGrab. To find the Redux articles, search for the keyword Redux.

I welcome any contributions to either series, but please follow the guidelines when submitting articles to either.

Conclusion

There you go, a free ASP.NET 2.0 numeric input control that suits my needs and hopefully yours.

Updates

  • 2006/02/21
    • Internationalized so that the decimal separator (usually '.' or ',') is determined by the current culture.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Gary Dryden

Software Developer (Senior)

Canada Canada

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Generala small bug Pinmembertuhucon5:53 6 May '07  
GeneralNumericInput Javascript PinmemberBrad Vin0:58 23 Mar '06  
GeneralRe: NumericInput Javascript PinmemberGary Dryden2:14 23 Mar '06  
GeneralAllowing to type directly ".5" PinmemberAntoine Marie3:22 9 Mar '06  
GeneralNeed the DLL PinmemberAntonino Ferrando23:47 7 Mar '06  
GeneralRe: Need the DLL PinmemberRatulSaikia19:46 8 Mar '06  
Question.DLL File Not Included PinmemberBig Tones12:53 7 Mar '06  
AnswerRe: .DLL File Not Included PinmemberGary Dryden13:03 7 Mar '06  
GeneralRe: .DLL File Not Included PinmemberBig Tones15:17 7 Mar '06  
GeneralRe: .DLL File Not Included PinmemberAntonino Ferrando23:48 7 Mar '06  
AnswerRe: .DLL File Not Included Pinmemberhitman_s20:18 23 Jun '06  
GeneralAuxilio PinmemberGerardoPeder3:27 22 Feb '06  
GeneralRe: Auxilio PinmemberGary Dryden4:22 22 Feb '06  
GeneralRe: Auxilio PinmemberGerardoPeder4:06 23 Feb '06  
GeneralRe: Auxilio PinmemberGary Dryden4:47 23 Feb '06  
GeneralRe: Auxilio Pinmembercomputerguru9238215:49 27 Feb '06  
GeneralRe: Auxilio Pinmembercomputerguru9238215:50 27 Feb '06  
GeneralHardcoded decimal separetor = No international support Pinmembersimone massaro7:30 21 Feb '06  
GeneralRe: Hardcoded decimal separetor = No international support PinmemberGary Dryden8:59 21 Feb '06  
GeneralRe: Hardcoded decimal separetor = No international support Pinmembersimone massaro9:26 21 Feb '06  
GeneralRe: Hardcoded decimal separetor = No international support Pinmemberdave_ferreira18:43 7 Mar '06  
GeneralRe: Hardcoded decimal separetor = No international support Pinmembersimone massaro3:48 8 Mar '06  
GeneralRe: Hardcoded decimal separetor = No international support Pinmemberdave_ferreira4:03 8 Mar '06  
GeneralRe: Hardcoded decimal separetor = No international support Pinmembersimone massaro5:15 8 Mar '06  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 8 Mar 2006
Article Copyright 2006 by Gary Dryden
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid