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

2019-04-12 01:56发布

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.

4条回答
地球回转人心会变
2楼-- · 2019-04-12 02:24

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" />
查看更多
放荡不羁爱自由
3楼-- · 2019-04-12 02:28

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

查看更多
Emotional °昔
4楼-- · 2019-04-12 02:33

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

查看更多
三岁会撩人
5楼-- · 2019-04-12 02:46

use jquery masked text box Masked Input Plugin 1.2.2

查看更多
登录 后发表回答