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.
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
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
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.
There you go, a free ASP.NET 2.0 numeric input control that suits my needs and hopefully yours.
- Internationalized so that the decimal separator (usually '.' or ',') is determined by the current culture.