Click here to Skip to main content
15,891,409 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have two radio buttons(True and False) on a page.
I could get the value Zero or 1 from the database.
When I get the value 1 then "True" radio button should be checked otherwise "False" should be checked.
How could I achieve this functionality in MVC 4.0?
Please give your suggestions.

Thank you,

Regards,
Ashish
Posted

1 solution

CSHTML Code:
------------

@Html.RadioButtonFor(model => model.trueFalseAnswer, true, new { id = "TrueFalseAnswer_true" })
True

@Html.RadioButtonFor(model => model.trueFalseAnswer, false, new { id = "TrueFalseAnswer_false" })
False
 
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