如何添加空列表框并将项目从一个列表框移动到另一个列表框,并使用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

查看:62
本文介绍了如何添加空列表框并将项目从一个列表框移动到另一个列表框,并使用EF代码将移动的数据保存到asp.net MVC中的数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何添加空列表框并将项目从一个列表框移动到另一个列表框,并首先使用EF代码将移动的数据保存到asp.net MVC的数据库中,



在我的项目中,我创建了一个列表框,显示数据库代码中的数据是这样的



在控制器中:

 publicActionResult Create()
{
IEnumerable< SelectListItem> items = db.IIDBS
.Select(c => newSelectListItem
{
Value = c.InstituteName,
Text = c.InstituteName
});
ViewBag.IIDBS = items;
return View();
}





在视图中:

<字段集> 
金融机构名单
<%:Html.ListBox(InstituteName,(IEnumerable< SelectListItem>)ViewBag.IIDBS,Select Financial Institute Name)%>
< / fieldset>





这里我想要另一个空的列表框和四个按钮,将第一个列表框的InstituteName移动到另一个列表框并保存这些数据进入数据库。



谁能告诉我怎么做......。

解决方案

你好,

你有没有得到相同的解决方案...



谢谢,

Vijay Kumar

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>



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…….

解决方案

Hi,
Did u get the solution for the same...

Thanks,
Vijay Kumar


这篇关于如何添加空列表框并将项目从一个列表框移动到另一个列表框,并使用EF代码将移动的数据保存到asp.net MVC中的数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆