I have bunch of check boxes which i want to put into drop down cause they are taking entire page. Is there any way if i can group them into drop down list.
I don't want to disturb existing code just want to put all the check boxes in to searchable drop down so that i can search and select whatever i want instead of looking full page.
(this my create view code)
@Html.LabelFor(m => m.Workstations, new { @class = "control-label" })
@for (var i = 0; i < Model.Workstations.Length; i++)
{
@Html.CheckBoxFor(m => Model.Workstations[i].Selected)
@Html.HiddenFor(m => Model.Workstations[i].Value)
@Html.DisplayFor(m => Model.Workstations[i].Text)
}
@Html.ValidationMessageFor(m => m.Workstations, "", new { @class = "text-danger" })
(My code on controller)
for (var i = 0; i < model.Workstations.Length; i++)
{
if (model.Workstations[i].Selected)
{
var workstation = db.Workstations.Find(model.Workstations[i].Value);
var documentWorkstation = db.DocumentWorkstations.Create();
documentWorkstation.Document = document;
documentWorkstation.Workstation = workstation;
foreach (var employee in workstation.Certificates.Where(m => m.CertificateStatus.Name == "Certified" || m.CertificateStatus.Name == "Pending").Select(m => m.Employee).Where(m => !m.Archived))
{
documentWorkstation.DocumentWorkstationEmployees.Add(employee);
}
document.DocumentWorkstations.Add(documentWorkstation);
}
}
What I have tried:
I tried bootstrap and jquery. I was able to create drop down but not what I was excepting.