My goal is to transfert data from a list to another. I was able to populates them, and now trying to do the rest. I want to add 2 buttons between the lists so I can send the data from both sides. I need help to code the button, and how to code the controller so I can collect the selected items in the lists (to remove and/or delete).
Here my model :
namespace OnlineTR.WebUI.Areas.Admin.Models
{
public class TestCategoryModel
{
public IEnumerable<TestCase> TestCasesAvailable { get; set; }
public IEnumerable<TestCase> TestCasesCurrent { get; set; }
}
}
View :
@model Models.TestCategoryModel
@Html.ListBoxFor(model => model.TestCasesAvailable, new SelectList(Model.TestCasesAvailable,"TestCaseId", "TestCaseName"))
@Html.ListBoxFor(model => model.TestCasesCurrent, new SelectList(Model.TestCasesCurrent, "TestCaseId", "TestCaseName"))
Here is an example post…you may try this…it is similar to your problem…
http://www.codeproject.com/Articles/136730/ASP-NET-MVC-2-Basics-Working-with-ListBoxes
Although it is done in MVC 2…that dynamics/approach will still remain the same in MVC 3…