I've an Hotel
model and there is a HotelPrice
list in the model.
What i'm trying to do is when user display hotel detail page let hotel prices' info be shown, also they can be editable. I've a breakfastIncluded
property on HotelPrice
instances which i have to display as radio button.
Here is my code:
<div>
@{
foreach(var hotelPrice in Model.HotelPrices)
{
<label class="mt-radio-inline>
@Html.RadioButtonFor(hotelModel => hotelPrice.breakfastIncluded, "1", new { @checked = (hotelPrice.Breakfast.ToString() == "1") })Yes
<span></span>
</label>
<label class="mt-radio-inline>
@Html.RadioButtonFor(hotelModel => hotelPrice.breakfastIncluded, "0", new { @checked = (hotelPrice.Breakfast.ToString() == "0") })No
<span></span>
</label>
}
}
When i display my page(i could not come editing part, yet), all breakfastIncluded
properties' radio buttons are displayed as unassigned and the last one's radio button is displayed wrongly(i.e it has to be "Yes" but it seems like "No").
However, when i checked by Inspect tool of browser, all of the radio buttons' checked property appears correct(i.e if it should be "Yes" that radio button's checked is true and "No"'s checked is false).
I'm new to html and i could not figure out why that happens. Can you help me? Thanks in advance.