DataFormatString to format Phone Number

ASP.NET

    Sponsored Links

    Next

  • 1. How do I read PocketPC registry from ASP.NET application
    Hi All, I would like to be able to read Device ID from PocketPC. I guess I have to read PocketPC's registry somehow. How do I do this? -- Thanks for your time Goran Djuranovic
  • 2. auto refresh to a mobile form
    hello , i have a mobile form that get dome parameters from the d.b . those parameters are change all the time . how can i make auto update to my form ? thanks .
  • 3. page not found error.
    Hello, My users use a mobile app that seems to return this error if the PDA is left unused for about 5 minutes. I suspect that I could solve this issue if I implement some type of page caching. Could someone please point me in the right direction. Thanks, niv
  • 4. TextBox and BackColor
    Hi all, Even if I set the BackColor property of a TextBox control it still appears with a white backcolor Why?

DataFormatString to format Phone Number

Postby Y3JwaWV0c2NobWFubg » Thu, 07 Dec 2006 01:09:01 GMT

I am showing a phone number field in an ObjectList control. I am trying to 
format the phone number using the DataFormatString, but I am having problems 
getting it to work. I need to to be formatted like this: 555-555-5555

I have the Phone Number field saved in the database as a varchar so it is 
coming across in the data binding as a string.

Here's an example of what's coming from the database:
4145555555

I have tried the following DataFormatString values with no avail:
###-###-####
{0:###-###-####}
{0:###'-'###'-'####}
{0:000-000-0000}
{0:nnn-nnn-nnnn}

Does anyone have any ideas?

-- 
Chris Pietschmann
 http://www.**--****.com/ 

Similar Threads:

1.Dialing numbers after initial phone number on PPC 2003 Phone Edition

Does anyone know how to dial some numbers after an initial phone number
has been dialed and the user has been connected?

I want to be able to call an extension that must be dialed after the
phone has connected.

Putting in pauses will not work.

Thanks for the help!

-Eric

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 like to format the 
column to read:

(123)-456-7890 or even 123.456.7890

Any suggestions for that one?

Thanks,

-Dave 


3.Format Mask for Phone Number Using Text Box

We already have a number of controls on the text box (i.e. Required).  How 
would I put a format mask on a text box and have it work with Microsofts 
validation process?

4.Formatting phone number of a DetailsView control

I have a data bound Details View control in asp.net 2.0 that formats a
phone number. The 'Default Mode' for the control is set to Edit. The
phone number field is a template field and I can successfully call a
function that formats the phone number when the control is filled.  But
when updating, the value being passed in to my format function is
vbNull instead of the value in the phone number field of the control.
How can I get the update value to be the value of the phone number
field?
Here is the  template field and formatting function. Thank You

<asp:TemplateField HeaderText="AltPhone" SortExpression="AltPhone"
ConvertEmptyStringToNull="False">
   <EditItemTemplate>
      <asp:TextBox ID="TextBox4" runat="server" MaxLength="14"
Text='<%# FormatPhoneNumber(DataBinder.Eval(Container.DataItem,
"AltPhone")) %>'></asp:TextBox>
   </EditItemTemplate>
</asp:TemplateField>

Public Function FormatPhoneNumber(ByVal strNumber As String) As String
   Dim strTemp as String = strNumber

   If strTemp.Length > 0 Then
      strTemp = strTemp.Replace("(", "")
      strTemp = strTemp.Replace(")", "")
      strTemp = strTemp.Replace("-", "")
   End If

   Return strTemp
End Function

5.Phone Number Format

6. format phone number

7. Formatting phone numbers in gridview

8. how to enter phone number in special format?



Return to ASP.NET

 

Who is online

Users browsing this forum: No registered users and 77 guest