Restrict numbers and letters in textbox - C#

前端 未结 6 1549
心在旅途
心在旅途 2021-01-24 10:35

I want to restrict what numbers and letters can be entered into a textbox. Let\'s say I only want to allow numbers 0-5 and letters a-d (both lower and uppercase). I already tri

6条回答
  •  清歌不尽
    2021-01-24 11:15

    If you are using ASP.NET Web Forms a regular expression validation would be the easiest. In MVC, a jQuery library such as MaskedEdit would be a good place to start. The answers above document the Windows forms approach well.

提交回复
热议问题