Click here to Skip to main content
15,867,834 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here I need to add isChecked value in Dictionary item.

I tried adding directly but I am getting following error:


" CS1501: No overload for method 'Add' takes 1 arguments"*. Is there any alternate way to add ischecked in Idictionary.

Cshtml Code is:

C#
<pre lang="cs">@{
     bool val = false;
     var isChecked = (val == true) ? new { @Checked = "checked" }  : null;
  }
@Html.RadioButtonFor(x => x.Status, "Male",new Dictionary<string,object>{{"id","GenderRdoButton"},{isChecked}})
Posted

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