how can i remove remove an item from the drop down list once an item has been selected from it in asp.net mvc4? See the process is having a list of conferences and a list of developers now you must select any conference and add a developer to it but i mustnt be able to add the developer twice to the conference? I want to know whether you can do this or whether there is validation for this? This is my controller:
public class ConferenceAttendantController : Controller
{
private PrjctMngmt2Entities db = new PrjctMngmt2Entities();
//
// GET: /ConferenceAttendants/
public ViewResult Index()
{
var ConferenceAttendants = db.ConferenceAttendants.Include("Conference").Include("Developer");
return View(ConferenceAttendants.ToList());
}
//
// GET: /ConferenceAttendants/Create
public ActionResult Create()
{
ViewBag.ConferenceID = new SelectList(db.Conferences.OrderBy(d => d.Name), "ConferenceID", "Name");
ViewBag.DeveloperID = new SelectList(db.Developers.Select(d => new { d.DeveloperID, DeveloperName = d.FirstName + " " + d.LastName }).OrderBy(d => d.DeveloperName), "DeveloperID", "DeveloperName");
return View();
}
//
// POST: /ConferenceAttendants/Create
[HttpPost]
public ActionResult Create(ConferenceAttendant ConferenceAttendant)
{
if (ModelState.IsValid)
{
db.ConferenceAttendants.Add(ConferenceAttendant);
db.SaveChanges();
return RedirectToAction("Index", "Conference");
}
return View();
}