vtfuture / BForms

Bootstrap Forms for ASP.NET MVC
MIT License
62 stars 33 forks source link

Select List Disabled Items #277

Open meister-d opened 8 years ago

meister-d commented 8 years ago

Hi BForms Team is it possible to disable ("grey out") an Item form a BsControlType.DropDownList. If I set the Disabled Property on the BsSelectListItem nothing happens when the Control is rendered:

private BsSelectList<string> GetRolesDropDown(Admin admin)
        {
            BsSelectList<string> rolesddl = new BsSelectList<string>();

            foreach(AdminRole r in AUDMServiceContext.Instance.Roles)
            {
                BsSelectListItem tmpItem = new BsSelectListItem
                {
                    Text = r.Name,
                    Value = r.Id
                };

                if (admin.Roles.FirstOrDefault(role => role.Id == r.Id) != null)
                   tmpItem.Disabled = true; 

                 rolesddl.Items.Add(tmpItem);
            }

            return rolesddl;
        }

Regards Dumitru

meister-d commented 8 years ago

An Example of what I think it should look and behave can be found here:

https://select2.github.io/examples.html#disabled-results

Regards Dumitru