[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Force phone number format in TextBox ASP.NET(VB)

Posted on 2011-10-25
4
Medium Priority
?
916 Views
Last Modified: 2012-05-12
What is the best way to force phone number formatting of a text box (i.e. (xxx) xxx-xxxx)

TIA
0
Comment
Question by:Mike Miller
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
sentner earned 2000 total points
ID: 37026123
0
 

Author Comment

by:Mike Miller
ID: 37026290
Ok I got it working. Question...
The MaskType attribute doesn't have phone number. If I set it as number, the format changes as soon as I click off the TextBox.

i.e.
I enter 999-999-9999 and as soon as I click off it reverts to
9999999999

The dashes are present when the form loads, but they don't stay. How do I force the format to stay
999-999-9999
0
 
LVL 2

Expert Comment

by:owaisyahya
ID: 37026435
You can do it with Masked edit ajax control, use (999) 999-9999 in the mask property of the control
0
 

Author Comment

by:Mike Miller
ID: 37026440
Yeah that doesn't work but I did figure it out. Adding validation to it worked.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month18 days, 18 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question