Maximum Length in ASP.NET CORE TextArea Control

22 Mar 20241 minute to read

You can enforce a maximum length limit for the text input in the TextArea using the MaxLength property. This property allows to define the maximum number of characters that users can input into the TextArea.

  • By setting the MaxLength property, you can control the length of text input, preventing users from exceeding a specified character limit.
<div class="control-section">
    <div class="control_wrapper TextArea-control-section">
        <ejs-textarea id="default" placeholder="Enter your comments" maxLength="20"></ejs-textarea>
    </div>
</div>
public ActionResult MaxLength()
{
    return View();
}

Output be like the below.

textarea

When the user reaches the specified limit, the TextArea prevents further input, ensuring compliance with the defined character limit. This feature helps maintain data integrity and provides users with clear feedback on the allowed input length.