简体   繁体   中英

How to Add an Empty List Box and move the items from one listbox to another listbox

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:

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

In View:

<fieldset>
<legend>MEMBER ACCESS RIGHTS</legend>
<divstyle="text-decoration: underline; text-align: center"><strong><spanstyle="background-color: #FFFFFF">MEMBER ACCESS RIGHTS</span></strong></div>
         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……. Please help…

Please read this Article . It will help you to achieve what you want to do. You need to refrence the JQuery lib in your page (View). It would be better if you show what you have done. As you are beginner it is understable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM