列表条目我不能找到和解决方案如何动态地添加通过另一个视图模型一个ViewModel进入编辑视图多数民众赞成加载。ASP.Net MVC视图模型包含的List <anotherViewModel>动态添加了anotherViewModel
可以说我有一个ViewModel这就是包含anotherViewModel的名单。
数据库模型:
public class ViewModel
{
public ViewModel()
{
anotherViewModel= new List<anotherViewModel>();
}
public string idViewModel{ get; set; }
public string description{ get; set; }
public List<anotherViewModel> aViewModel { get; set; }
}
用户加载编辑视图含有视图模型,当前具有2个entrys型anotherViewModel的。
用户应该从anotherViewModel entrys添加到视图模型类型anotherViewModel的另一个入口,甚至更改其属性的可能性。
另一个ViewModel处于局部视图。我尝试用ajax重新加载它,如果我这样做,在当前模型中所做的更改将丢失。因为我无法将模型交给控制器。
我知道必须有一些解决方案与jQuery,但我无法找到一个。
感谢您的帮助。