c# - Add new list items to a List<T> in MVC, Razor, ASP.NET with form -


i working on order form. page loads saved order items table. first row of table add new item row html.editofor() this:

@html.editorfor(m => m.orderitems[0].description) 

of course [0] represents in case nothing, demonstrate goal. show existing items, loop used:

for (int = 1; < model.orderitems.count; i++) { @html.editorfor(d => d.orderitems[i].description)} 

the order items stored in ienumerable list 4 properties (desc, partnum, cost, qty).

the question is: editor row form , when user presses add button on page how can form add new item existing list?

you can post 'new item' action ,the param 'new item', can modify existing list now


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -