Reputation: 1808
How to create control array in razor or asp.net-mvc3?
Upvotes: 1
Views: 628
Reputation: 380
var j=0;
$('input[type=text]').each(function (e) {
$(this).addClass('txt_' + j)
j++;
}
You can add class dynamically for each textbox. j is the number of textbox.
Upvotes: 1
Reputation: 26930
If you need input array you can do this:
@model List<mymodel>
for(int i = 0; i < Model.Count; i++)
{
@Html.EditorFor(model => model[i].SomeProperty)
}
Upvotes: 0