DataFormatString on boundcolumn not working

A

Aaron

Why doesn't the following code display a ten-digit number in the format
123-456-7890?

How can I format a ten-digit number as a telephone number?

<asp:BoundColumn DataFormatString="{0:###-###-####}"
DataField="Client_BPhone" HeaderText="BPhone">
<ItemStyle Width="200px"></ItemStyle>
</asp:BoundColumn>

The width is working, I can change border sizes, but I am unable to format
the string.

Any help would be appreciated.

Thanks,
Aaron
 
M

Michael Tkachev

May by you need to try to use ItemTemplate.

<%# (DataBinder.Eval(Container.DataItem,
"ColName")).ToString("000-000-0000")%>

Try to do it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top