Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid column formating again...
Message
General information
Forum:
ASP.NET
Category:
WebForms
Miscellaneous
Thread ID:
00722842
Message ID:
00723246
Views:
9
It didn't work for me either. I tried something like this.
<asp:TemplateColumn>

<%# FormatPhoneNumber(DataBinder.Eval(Container.DataItem, "PhoneNumber")) %>

</asp:TemplateColumn>


string FormatPhoneNumber(string tcString)
{
  return Regex.Replace(tcString, "(\d{3})(\d{3})(\d{4})", "($1) $2-$3");
}
>Ok folks,
>
>I have a phone number that is from a char field in SQL. I want to use this as a grid column. Only the numerals are stored. I want to display this like (999) 999-9999 in the column.
>
>I tried a DataColumnFormat of {0:(###) ###-####}... no joy... I swear I got that format right from the help. I get no error, but also, the data is not formated.
>
>I am leaning towards doing the formating in the select statements. At least I know how to do this. I had to do that with a bit. While where at it, what would be the format for a bit column that I want to display 'Yes' if true and nothing if no. Or would I need to do a template column?
>
>Thanks,
>BOb
- Jayesh
Previous
Reply
Map
View

Click here to load this message in the networking platform