I'm relatively new to ASP.NET MVC and am posting to see if anyone can point me to some sample code for adding/removing items. For example, if I have have a partial view (.cshtml) that's bound to a model which contains a list of items, is there a standard
way to allow users of the form to add or remove items from that list? Along the same lines, if my model has some items (properties) that are considered optional, how do I allow users to add this one of these items to the existing data if it doesn't already
exist? I'm using MVC 3 and Razor.
dgavian@yaho...
Member
15 Points
20 Posts
Add and Remove Items
May 14, 2012 04:04 PM|LINK
I'm relatively new to ASP.NET MVC and am posting to see if anyone can point me to some sample code for adding/removing items. For example, if I have have a partial view (.cshtml) that's bound to a model which contains a list of items, is there a standard way to allow users of the form to add or remove items from that list? Along the same lines, if my model has some items (properties) that are considered optional, how do I allow users to add this one of these items to the existing data if it doesn't already exist? I'm using MVC 3 and Razor.
Thanks
abdu292
Participant
1553 Points
371 Posts
Re: Add and Remove Items
May 14, 2012 05:03 PM|LINK
There is a great tutorial in the link below to add items in to the drop downs.
http://www.asp.net/mvc/tutorials/javascript/working-with-the-dropdownlist-box-and-jquery/using-the-dropdownlist-helper-with-aspnet-mvc
YOu can use, the delete item also, by adding some code in to it.
With best regards,