如何添加空列表框并将项目从一个列表框移动到另一个列表框,并使用EF代码将移动的数据保存到asp.net MVC中的数据库中 [英] How to Add an Empty List Box and move the items from one listbox to another listbox, and save the moved data into database in asp.net MVC using EF Code first
问题描述
如何添加空列表框并将项目从一个列表框移动到另一个列表框,并首先使用EF代码将移动的数据保存到asp.net MVC的数据库中,
在我的项目我已创建一个列表框,显示数据库代码中的数据是这样的
在控制器中:
Hi, How to Add an Empty List Box and move the items from one listbox to another listbox, and save the moved data into database in asp.net MVC using EF Code first,
In my Project I have create a list box which display the data from database code is like this
In Controller:
publicActionResult Create()
{
IEnumerable<SelectListItem> items = db.IIDBS
.Select(c =>newSelectListItem
{
Value=c.InstituteName,
Text=c.InstituteName
});
ViewBag.IIDBS = items;
return View();
}
在视图中:
In View:
<fieldset>
List of Financial Institute
<%:Html.ListBox("InstituteName",(IEnumerable<SelectListItem>) ViewBag.IIDBS,"Select Financial Institute Name") %>
</fieldset>
这里我想要另一个空的Listbox和四个按钮移动InstituteNameof第一个列表框到另一个列表框并将这些数据保存到数据库中。
任何人都可以告诉我该怎么做......。
Here I want another empty Listbox and four button which move InstituteNameof first listbox to another listboxand save those data into database.
Can anyone tell me how to do this…….
推荐答案
这篇关于如何添加空列表框并将项目从一个列表框移动到另一个列表框,并使用EF代码将移动的数据保存到asp.net MVC中的数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!