Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<td>&nbsp;@Html.LabelFor(model => model.DeductorType)</td>
               <td>
                   @{ List<SelectListItem> li = new List<SelectListItem>();
                    li.Add(new SelectListItem { Text = "Select", Value = "0", Selected = true });
                    li.Add(new SelectListItem { Text = "A-Central Government", Value = "A-Central Government"});
                    li.Add(new SelectListItem { Text = "B-Body Of Individuals", Value = "B-Body Of Individuals" });
                    li.Add(new SelectListItem { Text = "D-Satutary Body(Central Govt.)", Value = "D-Satutary Body(Central Govt.)" });
                    li.Add(new SelectListItem { Text = "E-Satutary Body(State Govt.)", Value = "E-Satutary Body(State Govt.)" });
                    li.Add(new SelectListItem { Text = "F-Firm", Value = "F-Firm" });
                    li.Add(new SelectListItem { Text = "G-Autonomous Body(Central Govt.)", Value = "G-Autonomous Body(Central Govt.)" });
                    li.Add(new SelectListItem { Text = "H-Autonomous Body(State Govt.)", Value = "H-Autonomous Body(State Govt.)" });
                    li.Add(new SelectListItem { Text = "J-Artificial Juridical Person", Value = "J-Artificial Juridical Person" });
                    li.Add(new SelectListItem { Text = "K-Company", Value = "K-Company" });
                    li.Add(new SelectListItem { Text = "L-Local Authority(Central Govt.)", Value = "L-Local Authority(Central Govt.)" });
                    li.Add(new SelectListItem { Text = "M-Branch/Division of Company", Value = "M-Branch/Division of Company" });
                    li.Add(new SelectListItem { Text = "N-Local Authority(State Govt.)", Value = "N-Local Authority(State Govt.)" });
                    li.Add(new SelectListItem { Text = "P-Association of Person(AOP)", Value = "P-Association of Person(AOP)" });
                    li.Add(new SelectListItem { Text = "Q-Individual/HUF", Value = "Q-Individual/HUF" });
                    li.Add(new SelectListItem { Text = "S-State Government", Value = "S-State Government" });
                    li.Add(new SelectListItem { Text = "T-Association of Person(Trust)", Value = "T-Association of Person(Trust)" });
               }
               &nbsp;@Html.DropDownListFor(model => model.DeductorType, li, new { style = "width:160px"})
               @Html.ValidationMessageFor(model => model.DeductorType)
           </td>






this is the code for drop down list in mvc4
Posted

1 solution

Use the change event of the drop down to analyse the select value, and based on the value enable\disable your checkboxes.

Google "jquery select change event" or "jquery select change event mvc", and "jquery disable textbox" for examples of both, then put them together.
 
Share this answer
 

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