an ASP.NET Open Source CMS & eCommerce platform
Search:
Skip Navigation LinksHome > DotShoppingCart Forums > Support > Using DotShoppingCart > Format Phone# in Order Confirmation
Last Post 3/15/2010 1:41:29 PM By Bahram. 2 replies.
3/12/2010 2:34:37 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Format Phone# in Order Confirmation
 How Can I format Phone# in Order Confirmation, or where in the code use my PhoneFormat() function for output on Order template
3/15/2010 12:04:13 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Format Phone# in Order Confirmation
Take a look at web\controls\AddressInput.ascx.cs .
DotShoppingCart Staff
3/15/2010 1:41:29 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: Format Phone# in Order Confirmation
 
This is my code and how I used it: It is working and you can use it too.
 
 
 
using System.Text.RegularExpressions;
  
...........
   public string Phone
   {
        get { return FormatUSPhone(telPhone.Telephone); }
    }
 .......
 
public string FormatUSPhone(string num)
{
    //first we must remove all non numeric characters
    num = num.Replace("(", "").Replace(")","").Replace("-","");
    string results = string.Empty;
    string formatPattern = @"(\d{3})(\d{3})(\d{4})";
    results = Regex.Replace(num, formatPattern, "($1) $2-$3");
   
    return results;
 }