This is a migrated thread and some comments may be shown as answers.

Formating Column:FormatString

3 Answers 122 Views
GridView
This is a migrated thread and some comments may be shown as answers.
parag patel
Top achievements
Rank 1
parag patel asked on 31 Dec 2009, 11:43 AM
Hi I am using Telerik.WinControls.UI.RadGridView Control


Now I have one field which displays telephone number
my input will be >10 digit no.

I want to display it in this format: (###) ###-####Ext.####

Can you help me in this topic how can I format this....?

3 Answers, 1 is accepted

Sort by
0
Robert
Top achievements
Rank 1
answered on 31 Dec 2009, 06:28 PM
Hello parag patel,

You should be able to accomplish this through the use of a GridViewMaskBoxColumn. Once you have this column in place for your specific field that contains the numeric values of the phone numbers, use the following settings:

Mask: (000) 000-0000 Ext.0000
MaskType: Standard
FormatString: {0:(###) ###-#### 'Ext.' ####}

I hope this information helps.

- Robert
0
parag patel
Top achievements
Rank 1
answered on 01 Jan 2010, 06:48 AM
Thanks for your reply

but what happens that it is not compulsory that each time I will have 14 digit no

so some time no may be of 10 digit

at that time the output comes like this:

look at this example:
I want to format it like this: (908) 123-4567Ext.89

I am using following code: CDbl(ContactPhone).ToString("(###) ###-####'Ext'.####") or (your format string in grid)

But I get output like this:(9) 081 2345Ext.6789

Can help me in this????
0
Martin Vasilev
Telerik team
answered on 05 Jan 2010, 02:38 PM
Hello parag patel,

Please, see our Demo application. There you can find a sample demonstrating GridViewMaskBoxColumn and phone number formats -- GridView->Columns->Column Types. Do not hesitate to contact us again if you have any other questions.

Greetings,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
parag patel
Top achievements
Rank 1
Answers by
Robert
Top achievements
Rank 1
parag patel
Top achievements
Rank 1
Martin Vasilev
Telerik team
Share this question
or