Phone Format (770) 123-1234

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Phone Format (770) 123-1234

    Hi,

    How do I apply phone format in a string field? for example (770) 123-1234.
    Please let me know.

    Thanks.

    Eddy


    Eddy Soeparmin Guest

  2. Similar Questions and Discussions

    1. Format Phone Number
      I have a text feild (homephone) in MSAccess that hold phone numbers (410)543-3333 When I display these in a <CFOUTPUT>#HOMEPHONE#<\CFOUTPUT> the...
    2. Format Phone Number String in Datagrid Column
      Greetings, I have a 10 digit phone number stored as a string in a SQL server table. My datagrid currently displays it as 1234567890, but I would...
    3. Placing an image in a Tab Fixed format without messing up the format??
      I will do my best to explain the problem. First of all, this is an XP machine and I am using CS InDesign (the version of InDesign that one can...
    4. Phone Number Format
      Ken, your regex has to be mapped to the INPUT, not the output. by including parens and dashes in the regex, you are guaranteeing that the...
    5. Fire IISReset command on event aspnet_wp.exe (PID: 1234) was recycled...
      Dear All, I would like run a program that does an IISReset when aspnet_wp.exe (PID: 1234) was recycled...In IIS service we have a property...
  3. #2

    Default Re: Phone Format (770) 123-1234

    Hi Eddy,

    If you are validating input, you can use a RegularExpressionValidator and
    select U.S. Phone Number in the Regular Expression Editor (by clicking the
    elipses in the ValidationExpression box in the RegularExpressionValidator's
    Properties window).


    --
    Ray Dixon - Microsoft MVP
    [email]ray@NOSPAM.greeble.com[/email]
    (remove NOSPAM. from my e-mail address for a direct reply)


    "Eddy Soeparmin" <esoeparmin@clientprofiles.com> wrote in message
    news:uCKkx2QVDHA.2068@TK2MSFTNGP11.phx.gbl...
    > Hi,
    >
    > How do I apply phone format in a string field? for example (770) 123-1234.
    > Please let me know.
    >
    > Thanks.
    >
    > Eddy
    >
    >

    Ray Dixon [MVP] Guest

  4. #3

    Default Re: Phone Format (770) 123-1234

    you'd have to use javascript to do this
    "Eddy Soeparmin" <esoeparmin@clientprofiles.com> wrote in message
    news:%23CwhiETVDHA.2012@TK2MSFTNGP10.phx.gbl...
    > Hi Ray,
    >
    > No, this is not at validation. It's for display. For example, I just
    > retrieved data from database and would like to display phone number in
    (123)
    > 123-1234 format within a datagrid.
    >
    > Eddy
    >
    > "Ray Dixon [MVP]" <ray@NOSPAM.greeble.com> wrote in message
    > news:uufguJSVDHA.2024@TK2MSFTNGP12.phx.gbl...
    > > Hi Eddy,
    > >
    > > If you are validating input, you can use a RegularExpressionValidator
    and
    > > select U.S. Phone Number in the Regular Expression Editor (by clicking
    the
    > > elipses in the ValidationExpression box in the
    > RegularExpressionValidator's
    > > Properties window).
    > >
    > >
    > > --
    > > Ray Dixon - Microsoft MVP
    > > [email]ray@NOSPAM.greeble.com[/email]
    > > (remove NOSPAM. from my e-mail address for a direct reply)
    > >
    > >
    > > "Eddy Soeparmin" <esoeparmin@clientprofiles.com> wrote in message
    > > news:uCKkx2QVDHA.2068@TK2MSFTNGP11.phx.gbl...
    > > > Hi,
    > > >
    > > > How do I apply phone format in a string field? for example (770)
    > 123-1234.
    > > > Please let me know.
    > > >
    > > > Thanks.
    > > >
    > > > Eddy
    > > >
    > > >
    > >
    > >
    >
    >

    Showjumper Guest

  5. #4

    Default Re: Phone Format (770) 123-1234

    Function FormatPhoneNumbers(ByVal strInputPhoneNumber As String) As String

    'Strip off the ( , ) and -

    Dim strPhoneNumber As String

    strInputPhoneNumber = strInputPhoneNumber.Replace(" ", "")

    strInputPhoneNumber = strInputPhoneNumber.Replace("(", "")

    strInputPhoneNumber = strInputPhoneNumber.Replace(")", "")

    strInputPhoneNumber = strInputPhoneNumber.Replace("-", "")

    'Now format it

    If strInputPhoneNumber.Length >= 3 Then

    strPhoneNumber = "(" & strInputPhoneNumber.Substring(0, 3) & ") "

    If strInputPhoneNumber.Length < 6 Then

    strPhoneNumber = strPhoneNumber & strInputPhoneNumber.Substring(3,
    strInputPhoneNumber.Length - 3)

    Else

    strPhoneNumber = strPhoneNumber & strInputPhoneNumber.Substring(3,
    3) & "-" & strInputPhoneNumber.Substring(6)

    End If

    End If

    Return strPhoneNumber





    End Function


    --
    Swanand Mokashi
    Microsoft Certified Professional
    [url]http://www.swanandmokashi.com/[/url]
    Home of the Stock Quotes, Quote of the day and Horoscope web services
    "Eddy Soeparmin" <esoeparmin@clientprofiles.com> wrote in message
    news:%23CwhiETVDHA.2012@TK2MSFTNGP10.phx.gbl...
    > Hi Ray,
    >
    > No, this is not at validation. It's for display. For example, I just
    > retrieved data from database and would like to display phone number in
    (123)
    > 123-1234 format within a datagrid.
    >
    > Eddy
    >
    > "Ray Dixon [MVP]" <ray@NOSPAM.greeble.com> wrote in message
    > news:uufguJSVDHA.2024@TK2MSFTNGP12.phx.gbl...
    > > Hi Eddy,
    > >
    > > If you are validating input, you can use a RegularExpressionValidator
    and
    > > select U.S. Phone Number in the Regular Expression Editor (by clicking
    the
    > > elipses in the ValidationExpression box in the
    > RegularExpressionValidator's
    > > Properties window).
    > >
    > >
    > > --
    > > Ray Dixon - Microsoft MVP
    > > [email]ray@NOSPAM.greeble.com[/email]
    > > (remove NOSPAM. from my e-mail address for a direct reply)
    > >
    > >
    > > "Eddy Soeparmin" <esoeparmin@clientprofiles.com> wrote in message
    > > news:uCKkx2QVDHA.2068@TK2MSFTNGP11.phx.gbl...
    > > > Hi,
    > > >
    > > > How do I apply phone format in a string field? for example (770)
    > 123-1234.
    > > > Please let me know.
    > > >
    > > > Thanks.
    > > >
    > > > Eddy
    > > >
    > > >
    > >
    > >
    >
    >

    Swanand Mokashi Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139