My existing view contains model binding.
@model Catalog.Models.SomeModel
Now, i need to extend my "SomeModel" to contain a list of data "ListData". Binding these data would be fine, where i will use foreach to display the data.
@foreach(var element in Model.ListData) {
//do as needed...
}
The enhancement now i need to do is make the the controls populated in the foreach loop dynamic. Where i can add/remove a row of data. Basically, when i will add a new row, a new ListData object should be added to the list and accordingly for remove. For template i am planning to use Moustache.js.
For saving the data, right now Post is used which sends the model back to the action method. Now, i have the following doubts:
- Can i modify the listData and post the model just like it is being done right now? If yes how?
- Do i need to replace the current post approach and hit the action directly using javascript?