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

本小妞迷上赌 提交于 2019-12-21 20:15:32

问题


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.



来源:https://stackoverflow.com/questions/8110665/adding-a-format-to-the-textbox-in-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!