Frage

I have Address field in my web form.. I want to limit the characters in that textbox.. I don't know how to do this by mvc2..

My html code

<%: Html.TextBox("Address",Model.Address, new {@title="Enter your address"}) %>

If any chances in jquery is there means it will ok..

War es hilfreich?

Lösung

Here it is maxlength="x" where x: length

<%: Html.TextBox("Address",Model.Address, new {@title="Enter your address", @maxlength="10"}) %>

Or using jQuery,

$('#Address').attr('maxlength', '10');
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top