Thursday, March 22, 2012

Masking a String?

I am using a gridview and I want to mask the string that comes in as a phone number such as (###) ###-#### . If I have a numeric value I can format it using standard numeric formatting as follows:

<asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("Sales", "{0:c}") %>'></asp:TextBox>

If there a similar formatting function for formatting strings?

Thanks in advancewhy not just convert string phone number to a double and you can freely format it using String.Format

it might not be a good solution, but it works.

0 comments:

Post a Comment