Forms Data Controls :: Format Phone Number Not Working?
Jan 6, 2010
I have been attempting to find a solution for my phone number formatting problem for 2 hours now and I am not getting any closer. My 10 digit phone number is stored as a varchar(14) without any formatting (just 10 digits).
Here is the code to format the phone number in a gridview:
[Code]....
why the formatting won't work? It just displays the 10 numbers with no formatting.
I want a TextBox with a mask like (xxx) xxx-xxxx using a MaskedEditExtender. I tried to set up the mask property to "(999) 999-9999" or "(999) 999-9999" but nothing works. It there a way I can have the mask I want?
I have read through a lot of post but cannot find the answer I'm looking for. I'm using expression web 4 and asp.net 4.0 gridview to show database search results. The search works fine but the phone number mask from the database is not coming over in the results. I have tried some examples with the database, if I remove the mask on the column in the table and manually type in the phone number (###) ###-####, it works in the results.
If I keep the mask in the database, the results are just ########## in a row. I have also tried to use the datastring under edit colums with
{0:(###) ###-####} in the box with no luck. I have the HTML encode to False and the HTML format string set to true. I still get just the straight line of numbers for the results.
The database is a Access 2007 template and I'm actually using Access 2010.
In my gridview I have a datetime columns and couple of decimal number columns. Lets say I have a datetime value like this 19.03.2011 00:00:00 and I want it to seem like 19.03.2011. And I would like 2 decimal digits only. How can I achieve this?
How to validate the textboxes to avoid wrong information..for ex: I have a textbox phoneNum in that users can only enter the nums only. how to validate that?
I experience a strange issue with DropDownList today.
It is bind to SqlDataSource which produce about 1500 item. SqlDataSource working properly and no mistake in SQL.
When i bind it to a DropDownList, first item automatically selected on load. But if i try to select other items, DDL never renders. Width of DDL shrinks to zero. But if i use UP and DOWN arrows, i can go through items which appears on the first line of DDL. Shortly, DDL never render a LIST of data for me as it is supposed to do.
If restrict the data as "SELECT TOP 100 SupplierName blabla..", the DDL works properly. Is there any data limit in DDL? 1500 line is massive for DDL?
With the same SqlDataSource, ListView control is working succesfully.
I have a ListView control that pulls a phone number from a db table. I'd like to format the phone number in the presentation layer to look like (###) ###-####.
The code line currently looks like this. The page displays the phone# but unformatted, i.e. 9999999999.
[Code]....
Based on other posts I've looked at in this forum, I've also tried:
<li>Phone: <%# String.Format("{0:(###) ###-####}", Databinder.Eval (Container.DataItem("Phone"))) %> with no success. In fact, this particular line throws an exception in my application (Input string not in the correct format).
The datatype I'm using in SQL is varchar(15)
The MSDN documentation for the String.Format method hasn't been very helpful thus far.
But when it shows the graph its XAxis Date Format is not according to my requirement i.e. "MMM-yy" But its showing the format that is stored procedure giving to the DataSource binding of this chart.
I want to create Regular Expression for phone number and valid digits allowed are (,),-,+,0----9. If the left bracket ( is there,then its necessay that right bracket is also there. How to create the Regular Expression for the above. I dont know how to create the regular Expression,
area code should be entered in paranetheses is mandatory after area code there should be hypen and only three digit should be allowed to enter that is mandatory after 3 digit again hypen should be there that is mandatory and then 4 digit should be enter that is mandatory.
I want to get a formatted phone number from database as 123-123-1234I tried this but this is not workingtxtphone1.Text = String.Format("###-###-####", dt9.Rows(0).Item("Address"))
referring to: [URL] v nice it works.. but i have tried this before in my previous app it works but i just try now <%# Container.ItemIndex + 1 %> but not work ..what is the difrence in these
Im using the asp.net membership provider and I would like to know how to add fields for a first name, last name, and phone numbre on my registration page with the CreateUserWizard Control ando also how to insert this new data to tha membership database table. I already created the culumns for these but I don't know how to insert the new data from the CreateUserWizard Control.
I have to make a login form using vb.net. The login form should either accept
Username ID or
Email ID or
Phone number
---- either of one ,and match it with the password of the corresponding record in the user table.
The user table has following column:- U_ID(varchar),mail(varchar),Phone(Number),Password(Varchar)
The form has two textfields - 1. Username
2.Password
And a submit button. If combination is correct I should be redirected to the Index page.
But I don't have to scan through all the columns of the user table to match the password.
(a)If the user enters user_id say- ID 10012 then we should be able to search only the record in the user_id column as it has alphanumeric or varchar data type and match with corresponding password.
(b)If the user enters Email id we should be able to search through the email id column as email id contains "@ and ." sign.
(c)If the user enters phone number then we should search only the phone column as it has numeric datatype.
any one know why are the following two give me different result? they should both give me no results as the value I give is not available. however, number 1 give me many results, and number 2 works as expected. I'd like the number 1 working as the same as number 2.
1. DECLARE
@SearchMCat nvarchar, @SearchTitle nvarchar, @SearchDesc nvarchar SET @SearchMCat = 'fjiewo;jafoia' SET @SearchTitle = 'fryere' SET @SearchDesc = 'fdsfdsafae33' SELECT ArticleCategory.CategoryDisplayName, Article.AudioPlaybackTargetTabID, Article.VideoPlaybackTargetTabID, Article.StartTime, Article.DateAdded, Article.Body, Article.Synopsis, Article.Title, Article.ArticleHasAudio, Article.ArticleHasVideo, Article.createdBy, Article.RatingTotal, Article.RatingCount, Article.ArticleID, ArticleCategory.CategoryName FROM ArticleCategory RIGHT OUTER JOIN Article ON ArticleCategory.ArticleCategoryID = Article.MasterCategory WHERE (ArticleCategory.CategoryName LIKE '%' + @SearchMCat + '%') or (Article.Title LIKE '%' + @SearchTitle + '%') or (Article.Body LIKE '%' + @SearchDesc + '%')
2.
SELECT ArticleCategory.CategoryDisplayName, Article.AudioPlaybackTargetTabID, Article.VideoPlaybackTargetTabID, Article.StartTime, Article.DateAdded, Article.Body, Article.Synopsis, Article.Title, Article.ArticleHasAudio, Article.ArticleHasVideo, Article.createdBy, Article.RatingTotal, Article.RatingCount, Article.ArticleID, ArticleCategory.CategoryName FROM ArticleCategory RIGHT OUTER JOIN Article ON ArticleCategory.ArticleCategoryID = Article.MasterCategory WHERE (ArticleCategory.CategoryName LIKE '%' + 'fdsafdsafdsa' + '%') or (Article.Title LIKE '%' + 'fffaery' + '%') or (Article.Body LIKE '%' + 'fdas3r43ffdsa' + '%')