In my MVC Application my form contains a checkbox and dropdownlist.When i check the checkbox to true i want to disable dropdownlist and vice versa. Also i want to populate a ‘None’ value as the selected item in dropdownlist, there is some other datas in dropdownlist populating from db. There have any solution? Please help me to resolve this.
Thanks
In my MVC Application my form contains a checkbox and dropdownlist.When i check the
Share
You will need to use javascript for this. With jQuery you could subscribe to the
.changeevent of the checkbox and toggle the dropdown’s disabled attribute:That’s not a pretty common requirement. You will have to add this item manually in front of the
IEnumerable<SelectListItem>collection that you are passing as second argument to the DropDownListFor helper.