ASP.NET Text-Box Character Limiter

1

I'm trying to implement a character limiter for this text-box, but I have no idea how to do this. It is a page of insertion of posts in a portal and the title must have a limit.

<div class="form-group col-md-12">
    <div class="form-group col-md-12">
        @Html.LabelFor(m => m.Titulo)
        @Html.TextBoxFor(m => m.Titulo, new { @class = "form-control" })
        @Html.ValidationMessageFor(m => m.Titulo)                                  
    </div> 
</div>

How can I implement a limiter?

@Html.TextBoxFor(m => m.Titulo, new { @class = "form-control" })
    
asked by anonymous 25.08.2017 / 21:56

1 answer

5

You could use it this way:

@Html.TextBoxFor(m => m.Titulo, new { @maxlength="10", @class = "form-control" })
    
25.08.2017 / 22:01