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