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..

有帮助吗?

解决方案

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');
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top