Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.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.
Posted
Updated 18-Feb-19 22:34pm

Maybe this helps?
Dropdown with Multiple checkbox select with jQuery[^]

As I can see, you could add other elements like lines to visualize groups.
e.g.
<li><hr /></li>
 
Share this answer
 
Maybe this helps?
Dropdown with Multiple checkbox select with jQuery[^]

You could add other elements like lines to visualize groups.
<li><hr /></li>
 
Share this answer
 
Comments
Richard Deeming 20-Feb-19 9:26am    
You've posted the same solution twice. You should delete one of these.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900