Developing a feature rich custom TextBox
For most of the software applications user inputs are accepted via TextBoxes.
As per your business requirements inputs differ from Alpha, AlphaNumeric,
Integers or Decimals. You may need further fine tuning. Lets say you need only
Alpha characters entered in the TextBox. Further there are 3 possibilities. The
characters can be All Caps , All Small or InitCap.
The control has its own properties as under:
1. For Only Alpha / Alpha Numeric characters
a. All case
b. Upper case
c. Lower case
2. For Numeric characters
a. Only Numeric
b. Numeric with decimals
To achieve above functionality I have declared 4 properties
a. ACCEPTLETTERS - Which have following 4 values
1.ALL - Accepts alpha / numeric /
2.ALPHA - Accepts alpha
3.NUMERIC - Accepts numeric
4.ALPHANUMERIC - Accepts alphanumeric
and decimal if ACCEPTDECIMAL property is set to TRUE
b. ALLOWDECIMALS - Boolean accepts TRUE / FALSE
c. ALPHACASE - Which have following 4 values
1.NONE - Accepts any case
2.LOWER - Accepts / converts input in
3.UPPER - Accepts / converts input in
4.INITCAP - Accepts / converts input
in First letter Upper
d. DECIMALLENGTH - Maximum number of decimals allowed when
ACCEPTLETTERS property is set to NUMERIC.
The control also takes care of copy and paste done by user. This is achieved
property of the page. Control is not designed to take care for number of
decimals entered when input is other than Numeric.
- In the �Toolbox� add reference of the control using Add / Remove Items(Right click on toolbox and click �Add Remove Items�).
- Drag the control as normal TEXTBOX.
The download contains two projects
1. wccTextBox � Web Control Library project for creating Textbox control
2. TextBoxControlDemo � ASP.NET with C# project which is web application. This
project is demo for implementation of the control.
Note: The control perfectly works in Internet Explorer 6.0.
I am science graduate, Total IT experience 5+ years working with 3i-Infotech Ltd. since last 1.5 years.