TextBox allows Text more than the MaxLength when Text is Assigned

前端 未结 2 953
南方客
南方客 2021-01-27 11:09

TextBox\'s MaxLength was set to 5. It works fine that it does not allows to enter or paste the Text more than the MaxLength. But it allows when the Tex

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-27 11:30

    FROM MSDN:

    TextBox.MaxLength Property

    You can use this property to restrict the length of text entered when the data is to be stored in a database so that the text entered into the control does not exceed the maximum length of the corresponding field in the database.

    TextBox.MaxLength property does not affect characters that are added programmatically.
    

    Read more here.

提交回复
热议问题