Search code examples
c#asp.netvalidationmaskedtextbox

Adding a format to the TextBox in asp.net


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.


Solution

  • 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" />