DataFormatString to format Phone Number

ASP.NET

    Sponsored Links

    Next

  • 1. bgsound tag with asp.net mobile
    I have tried using bgsound in my mobile web app but this tag generates an error. Is there another tag that I could use instead of this one? niv
  • 2. Error Server
    Hi, i'm development a mobile page with ASP.NET Web Matrix. To see if my page is correct, i put the URL of my IIS in a Emulator On Line. The page load correct, but when i push back buttom, the emulador said: "is not a WML page". I don't know what happend. This is the code: ---------------- Function GetOrders() As System.Data.DataSet Dim connectionString As String = "server='(local)'; trusted_connection=true; database='databasepuntonet'" Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString) Dim queryString As String = "SELECT [Orders].* FROM [Orders]" Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand dbCommand.CommandText = queryString dbCommand.Connection = dbConnection Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter dataAdapter.SelectCommand = dbCommand Dim dataSet As System.Data.DataSet = New System.Data.DataSet dataAdapter.Fill(dataSet) Return dataSet End Function Sub Page_Load(Sender As Object, E As EventArgs) If Not Page.IsPostBack Then OrderList.DataSource = GetOrders() OrderList.DataBind() End If End Sub ------------------ Before, i inserted a OrderList Web Control. Thanks.
  • 3. Creating only one set of webpages for different devices?
    hi, i'm trying to find out the most "common" or "popular" way to create a single set of web pages for browsing and interaction over different devices. ie. i) full range of info (images, text etc) on desktop PC browsers, ii) selected info on PDAs, mobile phones, wireless devices etc. i have seen some suggestions such as using different css or xsl to transfrom xml depending on the targeted device browser. how do we check what type of client (desktop browsers or wireless devices) is accessing the page? also what difference does it make if devices is WAP or WML? (pardon my ignorance if the above questions do not make sense, i'm a newbie) another thing i read up on was Microsoft Mobile Internet Toolkit(MMIT). does this address another issue altogether? all in all, i wish to find out all the possible technologies, methods, languages to enable a developer to create only one set of web pages for many different web-enabled devices (and ultimately the most widely used idea today). pls provide me with some insights, and preferably with some code samples or references. thanks in advance. champs.

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 69 guest