473,698 Members | 2,153 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1996
Try using the RegularExpressi onValidator, 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********@hotm ail.com
http://www.nathansokalski.com/

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:O%******** ********@TK2MSF TNGP03.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********@hot mail.comwrote in message
news:eN******** ********@TK2MSF TNGP02.phx.gbl. ..
Try using the RegularExpressi onValidator, 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********@hotm ail.com
http://www.nathansokalski.com/

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:O%******** ********@TK2MSF TNGP03.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 TextBoxWatermar k 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********@hotm ail.com
http://www.nathansokalski.com/

"Rich" <r@r.rwrote in message
news:45******** **************@ un-2park-reader-01.sydney.pipen etworks.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********@hot mail.comwrote in message
news:eN******** ********@TK2MSF TNGP02.phx.gbl. ..
>Try using the RegularExpressi onValidator, 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
demonstratio n 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
configuratio n 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********@hotm ail.com
http://www.nathansokalski.com/

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:O%******* *********@TK2MS FTNGP03.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 RegularExpressi onValidator 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********@hot mail.comwrote in message
news:eN******** ********@TK2MSF TNGP02.phx.gbl. ..
Try using the RegularExpressi onValidator, 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********@hotm ail.com
http://www.nathansokalski.com/

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:O%******** ********@TK2MSF TNGP03.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.ht m

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.ht m

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

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:OV******** ******@TK2MSFTN GP05.phx.gbl...
>I am trying to use RegularExpressi onValidator 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********@hot mail.comwrote in message
news:eN******** ********@TK2MSF TNGP02.phx.gbl. ..
>Try using the RegularExpressi onValidator, 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
demonstratio n 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
configuratio n 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********@hotm ail.com
http://www.nathansokalski.com/

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:O%******* *********@TK2MS FTNGP03.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
12704
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 anyone help, many thanks in advance.
1
6344
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 text box control end up in a field in a table with a data type of Date/Time. Is it possible to set up a mask on this text box control such that if one types any any of the following sequence of characters into the text box 06/25/04 6/25/04
9
2956
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 i enter "THIS IS A TEST" 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
2002
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 character. Is there a way to have that display before I type anything?
1
1906
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 when the user enters the password it is not masked and you can see the actual chars and not the asterisks. I've never seen anything like it.
2
1900
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 with Mozilla they did not work. Any body have any idea about these controls, or know where can i find it? And i wonder if we can write these controls with JavaScripts (Cross-Browser support) I appreciate your help. Thank You
7
4639
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
6155
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 custom message boxes if they are omitted. The one problem I am having is to create a custom message box when the input mask that I have specified for phone number is not followed. '! \ (999")" 000\-0000;;_' I have tried to insert this mask in the...
0
8672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8890
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8858
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6517
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5859
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4360
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3038
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.