473,405 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Mask for text boxes

Hi

I am using text boxes on a web form. How can I make it so users can insert
values only in the format 99-99-99 ?

Thanks

Regards

Feb 19 '07 #1
5 1987
Try using the RegularExpressionValidator, which will validate the user's
input. If you want to restrict the characters that the user can type, you
can use JavaScript (there is a function I wrote that adds this JavaScript if
you would like me to send it to you). You can also use something from the
ASP.NET AJAX Control Toolkit called MaskedEdit, which you can see a
demonstration of at:

http://ajax.asp.net/ajaxtoolkit/Mask...askedEdit.aspx

However, if you do not have the ASP.NET AJAX Control Toolkit already
installed, that may be more work than it's worth (my function is much
simpler, and you do not need to install anything or change any configuration
settings, but is not as fancy). Hopefully one of these options is what you
are looking for, or at least helps you find a solution. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:O%****************@TK2MSFTNGP03.phx.gbl...
Hi

I am using text boxes on a web form. How can I make it so users can insert
values only in the format 99-99-99 ?

Thanks

Regards

Feb 19 '07 #2
Checked out that Masked Edit Control, looks good, but WHY part of the AJAX
toolkit.

Is it doing ANYTHING that is asynchronous? Surely this can be implemented
completely client side with Javascript.

I suppose this control collection is MUCH more up to date and where all the
work is happening.

Just seems a bit weird...
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:eN****************@TK2MSFTNGP02.phx.gbl...
Try using the RegularExpressionValidator, which will validate the user's
input. If you want to restrict the characters that the user can type, you
can use JavaScript (there is a function I wrote that adds this JavaScript
if you would like me to send it to you). You can also use something from
the ASP.NET AJAX Control Toolkit called MaskedEdit, which you can see a
demonstration of at:

http://ajax.asp.net/ajaxtoolkit/Mask...askedEdit.aspx

However, if you do not have the ASP.NET AJAX Control Toolkit already
installed, that may be more work than it's worth (my function is much
simpler, and you do not need to install anything or change any
configuration settings, but is not as fancy). Hopefully one of these
options is what you are looking for, or at least helps you find a
solution. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:O%****************@TK2MSFTNGP03.phx.gbl...
>Hi

I am using text boxes on a web form. How can I make it so users can
insert values only in the format 99-99-99 ?

Thanks

Regards


Feb 19 '07 #3
Well, since I didn't write the controls I can't answer that for sure, but
there is a way to download the source code that was used to write them (it
is C# code). I am guessing, however, that the AJAX part is because of the
watermark (like the TextBoxWatermark control located at
http://ajax.asp.net/ajaxtoolkit/Text...atermark.aspx). Or
it might just be to simplify the coding, I haven't looked at the source
code. But I agree with you, it probably is possible to get the same (or at
least close to) the same results without using AJAX.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Rich" <r@r.rwrote in message
news:45**********************@un-2park-reader-01.sydney.pipenetworks.com.au...
Checked out that Masked Edit Control, looks good, but WHY part of the AJAX
toolkit.

Is it doing ANYTHING that is asynchronous? Surely this can be implemented
completely client side with Javascript.

I suppose this control collection is MUCH more up to date and where all
the work is happening.

Just seems a bit weird...
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:eN****************@TK2MSFTNGP02.phx.gbl...
>Try using the RegularExpressionValidator, which will validate the user's
input. If you want to restrict the characters that the user can type, you
can use JavaScript (there is a function I wrote that adds this JavaScript
if you would like me to send it to you). You can also use something from
the ASP.NET AJAX Control Toolkit called MaskedEdit, which you can see a
demonstration of at:

http://ajax.asp.net/ajaxtoolkit/Mask...askedEdit.aspx

However, if you do not have the ASP.NET AJAX Control Toolkit already
installed, that may be more work than it's worth (my function is much
simpler, and you do not need to install anything or change any
configuration settings, but is not as fancy). Hopefully one of these
options is what you are looking for, or at least helps you find a
solution. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:O%****************@TK2MSFTNGP03.phx.gbl...
>>Hi

I am using text boxes on a web form. How can I make it so users can
insert values only in the format 99-99-99 ?

Thanks

Regards



Feb 19 '07 #4
I am trying to use RegularExpressionValidator as it seems to be easiest to
me. What expression do I need for the following type of values;

A9 9AA
A99 9AA
A9A 9AA
AA9 9AA
AA99 9AA
AA9A 9AA

and

99-99-99

A= Alphabets (A-Z, a-z)
9 = digits (0-9)

Many Thanks

Regards

"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:eN****************@TK2MSFTNGP02.phx.gbl...
Try using the RegularExpressionValidator, which will validate the user's
input. If you want to restrict the characters that the user can type, you
can use JavaScript (there is a function I wrote that adds this JavaScript
if you would like me to send it to you). You can also use something from
the ASP.NET AJAX Control Toolkit called MaskedEdit, which you can see a
demonstration of at:

http://ajax.asp.net/ajaxtoolkit/Mask...askedEdit.aspx

However, if you do not have the ASP.NET AJAX Control Toolkit already
installed, that may be more work than it's worth (my function is much
simpler, and you do not need to install anything or change any
configuration settings, but is not as fancy). Hopefully one of these
options is what you are looking for, or at least helps you find a
solution. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:O%****************@TK2MSFTNGP03.phx.gbl...
>Hi

I am using text boxes on a web form. How can I make it so users can
insert values only in the format 99-99-99 ?

Thanks

Regards


Feb 19 '07 #5
Try taking a look at the following .NET documentation page:

ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxfund/html/0f8bffab-ee0d-4e0e-9a96-2b4a252bb7e4.htm

You probably want the following expression:

"\d\d-\d\d-\d\d"

However, take note that in this expression there MUST be a digit for \d. If
you want to make a \d optional, add a ? after it, as in the following:

"\d?\d-\d?\d-\d?\d" (this expression would match 1-1-1 or 12-12-12)

For more information on the ? see the following documentation page:

ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxfund/html/36b81212-6511-49ed-a8f1-ff080415312f.htm

Hopefully this will help you get started. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:OV**************@TK2MSFTNGP05.phx.gbl...
>I am trying to use RegularExpressionValidator as it seems to be easiest to
me. What expression do I need for the following type of values;

A9 9AA
A99 9AA
A9A 9AA
AA9 9AA
AA99 9AA
AA9A 9AA

and

99-99-99

A= Alphabets (A-Z, a-z)
9 = digits (0-9)

Many Thanks

Regards

"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:eN****************@TK2MSFTNGP02.phx.gbl...
>Try using the RegularExpressionValidator, which will validate the user's
input. If you want to restrict the characters that the user can type, you
can use JavaScript (there is a function I wrote that adds this JavaScript
if you would like me to send it to you). You can also use something from
the ASP.NET AJAX Control Toolkit called MaskedEdit, which you can see a
demonstration of at:

http://ajax.asp.net/ajaxtoolkit/Mask...askedEdit.aspx

However, if you do not have the ASP.NET AJAX Control Toolkit already
installed, that may be more work than it's worth (my function is much
simpler, and you do not need to install anything or change any
configuration settings, but is not as fancy). Hopefully one of these
options is what you are looking for, or at least helps you find a
solution. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:O%****************@TK2MSFTNGP03.phx.gbl...
>>Hi

I am using text boxes on a web form. How can I make it so users can
insert values only in the format 99-99-99 ?

Thanks

Regards



Feb 20 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: dude | last post by:
hello how would i make an input mask that only makes the first letter a capitol one? i've been playing around and testing various masks, also tried the wizard, but i've had no luck. could...
1
by: Miranda Evans | last post by:
In my application, a text box control resides in a form. The text box control is unbound, but--assuming all edits are passed when the user click a command button on the form--the contents of the...
9
by: Paul | last post by:
hi, is there an input mask i could use on a report to do the following: (1) if i enter "THISISATEST" on my form, i want the text box on my report to display: "T H I S I S A T E S T". (2) if...
2
by: BerkshireGuy | last post by:
Is there a way to display what the expected format is before entering a control. For instance, if I have the input mask of 99/99/0000;0;#, it shows me ##/##/##, but only when I type the first...
1
by: Joe Spin | last post by:
Hi, I'm using the TextBox.PasswordChar property with a '*' to mask passwords written in the textbox. In some workstations it works fine , but there are some workstations (win2K and XP) that...
2
by: Tai | last post by:
Hi all, I have an ASP.NET web project that requires some mask control for entering Birthday, SSN, Phone number. I searched on Google and found some mask controls that worked very well on IE. But...
7
by: CAradhana | last post by:
I have a textbox whose text should be of the format "xxx-xxx-xxxx" i.e if the user enters 1234567890 it should automatically show as 123-456-7890. How do i achieve this in ASP.NET with validations?
18
by: louie310 | last post by:
I am working on a Access data base as a school project. The data base has forms with fields that need to be filled out. The forms currently are set up where certain fields that are required have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.