Character limiter in ASP.NET text-box

Asked

Viewed 283 times

1

I’m trying to implement a character limiter for this text-box, but I have no idea how to do that. It is an insertion page of posts in a portal and the title needs to 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" })
  • 1

    This is ASP.NET, it has nothing to do with ASP Classic.

1 answer

5


You could use it this way:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.