mercredi 29 novembre 2017

Disable the checkbox based on value from the View bag Dynamically through Razor

I want the checkbox to generate the result similar to the following code, if the Value in the @ViewBag.Role is something other than "Unit Incharge":

@Html.CheckBoxFor(f => f.UnitInchargeSign_SDD, new { @disabled = "disabled" , @checked="checked"})`

How would i do it? How should i place the condition to disable it? I have seen other questions as well but I didn't understand how to place condition for my purpose.




Aucun commentaire:

Enregistrer un commentaire