Adding a format to the TextBox in asp.net

Shweta picture Shweta · Nov 13, 2011 · Viewed 56.6k times · Source

I need to format an asp.net text box in such a way that it accepts the user input only in the form of

### - ### - ### (#:numerics only).

Suggestions or answers please.

Answer

Lam Chau picture Lam Chau · Nov 13, 2011

MaskedEdit might be what you're looking for.

Here is an modified example from the link above:

<ajaxToolkit:MaskedEditExtender runat="server"
    TargetControlID="TextBox2" 
    Mask="999-999-9999" />