Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
All-Star
36644 Points
5432 Posts
Mar 30, 2012 01:42 PM|LINK
if you don't use ajax, then use this cool feature in languges called a for loop. keep the count of partials in a hidden field, and use a submit button (not link which woudl require javascript to post) to add.
@for (Model.CurrentIndex = 0; Model.CurrentIndex < Model.MaxPartials; ++ Model.MaxPartials) { @Html.Partial("thepartial") }
note: the parial shoud use the CurrentIndex:
@Html.TextboxFor(m=>m.field[m.CurrentIndex])
bruce (sqlwo...
All-Star
36644 Points
5432 Posts
Re: Add and remove partial views
Mar 30, 2012 01:42 PM|LINK
if you don't use ajax, then use this cool feature in languges called a for loop. keep the count of partials in a hidden field, and use a submit button (not link which woudl require javascript to post) to add.
@for (Model.CurrentIndex = 0; Model.CurrentIndex < Model.MaxPartials; ++ Model.MaxPartials)
{
@Html.Partial("thepartial")
}
note: the parial shoud use the CurrentIndex:
@Html.TextboxFor(m=>m.field[m.CurrentIndex])