asp.net mvc - ASP MVC Set RadioButton From Database -


I have an easy question for today.

I have two radio buttons:

Gender: <% = Html.RadioButton ("gender", "male", true)%> Male & lt;% = Html.RadioButton ("gender", "woman", true)%>

I have to select one based on the value returned from my database, the way I am trying to do it is:

  See data ["sex"] = data. Sax; // set radio button  

but that is not working I have tried every possible combination of isChecked properties I know that data Sax is returning either "male" or "woman" What should I do to check the appropriate radio button?

Remove the third parameter from the assistant:

  & lt;% = Html.RadioButton ("Gender", "Male")%> Male & lt;% = Html.RadioButton ("gender", "female")%> Female  

and in your controller action:

  see data ["gender"] = "female";  

will investigate the second radio.


Comments