Click here to Skip to main content
Sign Up to vote bad
good
See more: ASP.NETVB.NET
Is there a way to add the dasshes in a phone number while typeing it into a textbox?
Posted 10-Dec-12 2:42am


4 solutions

Hi,
 
Check this link, can help it
http://www.c-sharpcorner.com/Forums/Thread/56356/[^]
  Permalink  
Hi,
Use Masked Input Plugin...Here is the code and demo link.
http://digitalbush.com/projects/masked-input-plugin/
Hope This will help You.
  Permalink  
First
Imports System.ComponentModel
 
Then
Dim MaskPhone As New MaskedTextProvider("0000-0000") 'Here you use the number of caracters
 
So when the value it will come up with mask
When typing you can use that to my JS would be the simplest solution.
 
In Source you add the event "onKeyUp"
Exemple:
<asp:TextBox ID="TextBoxPHONE" runat="server" CssClass="textbox" Width="65px" onKeyUp="Mascara('PHONE',this,event);" MaxLength="10" TabIndex="31" ></asp:TextBox></td>
 
And the following function:
 
if (key! key = 9 &&! ​​= 8) {
         switch (type) {
case 'PHONE':
                 if (tam> = 5 && tam <9)
                     campo.value s.substr = (0, 4) + '-' + s.substr (4, 4);
                 if (tam> = 6 && tam == 10)
                     campo.value s.substr = (0, 5) + '-' + s.substr (5, 4);
                 break;
             }
     }
  Permalink  
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Christian Graus 544
1 Ron Beyer 296
2 OriginalGriff 258
3 samadhan_kshirsagar 229
4 Tadit Dash 193
0 Sergey Alexandrovich Kryukov 7,007
1 Prasad_Kulkarni 3,815
2 OriginalGriff 3,557
3 _Amy 3,372
4 CPallini 2,975


Advertise | Privacy | Mobile
Web02 | 2.6.130617.1 | Last Updated 12 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid