5 Answers, 1 is accepted
0
Sony Telkar
Top achievements
Rank 1
answered on 10 Jun 2009, 05:00 PM
I guess this should solve your problem.
String.Format(”{0:(###) ###-####}”, 18005551212);
Also you can visit this link. It could be helpful.
http://blog.stevex.net/index.php/string-formatting-in-csharp/
0
Rekha
Top achievements
Rank 1
answered on 10 Jun 2009, 05:45 PM
Thanks for the reply Sony. When I try to set the fomat property like you suggested, it returns the unformatted string. Also in the Value type my options are either numeric or date time. I am dealing with a string in a field called Phone and when I set the property to string.format("{0: (###) ###-####}",fields.Phone), I get my setting returned verbatim.
0
Hi Rekha,
Custom numeric formats are applicable only for numeric data so you cannot use them to format a string. To achieve the expected result you can use a user defined function and format the value with the help of the string methods.
Greetings,
Chavdar
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Custom numeric formats are applicable only for numeric data so you cannot use them to format a string. To achieve the expected result you can use a user defined function and format the value with the help of the string methods.
Greetings,
Chavdar
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Penny
Top achievements
Rank 1
answered on 25 Nov 2014, 03:18 PM
I've had success with this:
Format("{0:(###) ###-####}", CDbl(Fields.PrimaryContact.PhoneNumber)
Format("{0:(###) ###-####}", CDbl(Fields.PrimaryContact.PhoneNumber)
0
dave
Top achievements
Rank 1
Iron
answered on 12 May 2023, 03:05 PM
In the format field, select custom format, enter: (000) 000-0000
In the value field, enter CDbl(Fields.PhoneNumber)
In the value field, enter CDbl(Fields.PhoneNumber)