in this web programming tutorial you will learn that how we can format a phone number in US phone format in asp.net using c# compute programming language.
place this code in your aspx.cs file where ever your require to format the phone number.
place this code in your aspx.cs file where ever your require to format the phone number.
string homePhone1 = "(" + homePhone.Substring(0, 3) + ")"; string homePhone2 = " " + homePhone.Substring(3, 3); string homePhone3 = "-" + homePhone.Substring(6, homePhone.Length - 6); homeFormatted = homePhone1 + homePhone2 + homePhone3; phone_lbl.Text = homeFormatted;
Tags:
asp.net