0

Hi,
Is there a way to set a mask on the standard ASP.NET TextBox Web control? For example, I need to mask the input and display of a telephone number "###-###-####".

Thanks,
Mike

2
Contributors
2
Replies
7
Views
11 Years
Discussion Span
Last Post by mikefitz
0

There isn't any 'built-in' to dot net.

The best way is to use regular expressions to validate the input on the client and then also format it how you want for the DB serverside.

This is best because it allows the user to put (000) 000 0000 or 0000000000 or 000-000-0000 however they like but by time gets to DB is always 000-000-00000

I think masks have not been implemented because really they closely couple your UI with your data model which is not good practice. Regular expressions allow you to keep things independant.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.