Adding a format to the TextBox in asp.net [closed]

2019-04-12 02:38发布

问题:

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.

回答1:

MaskedEdit might be what you're looking for.

Here is an modified example from the link above:

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


回答2:

use jquery masked text box Masked Input Plugin 1.2.2



回答3:

You can use MaskedEdit ajax control..

MaskedEdit is an ASP.NET AJAX extender that attaches to a TextBox control to restrict the kind of text that can be entered. MaskedEdit applies a "mask" to the input that permits only certain types of characters/text to be entered. The supported data formats are: Number, Date, Time, and DateTime.

follow this link for details: http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/MaskedEdit/MaskedEdit.aspx



回答4:

You can either use jQuery as suggested by DeveloperX or use the MaskedEditExtender from AjaxControlToolkit.