Ive एक रूप है:@ Html.RadioButtonFor बूलियन
@using (Html.BeginForm("Buy", "Keys", FormMethod.Post))
{
<div class="calc_steps">
<div class="NumberedRow one">
1. @Html.DropDownListFor(model => model.PaymentSystem, Model.PaymentSystems, new { @class = "calcsteps_select styledselect" })
</div>
<div class="NumberedRow two">
2. <div class="cnt">
Укажите тип лицензии
<div class="radio-jquery-ui">@Html.RadioButtonFor(model => model.IsElite, "false") <label>Обычная</label></div>
<div class="radio-jquery-ui">@Html.RadioButtonFor(model => model.IsElite, "true") <label>Расширенная</label></div>
</div>
</div>
<div class="NumberedRow three">
3.
<div class="cnt">
Введите срок
@Html.TextBoxFor(model => model.NumDays)
</div>
</div>
<div class="itog">
Итого: <span id="ïtogo">0 рублей 00 копеек</span>
</div>
<div>
<input type="submit" value="Купить"/>
</div>
</div>
}
मॉडल:
public class BuyModel
{
public string PaymentSystem;
public bool IsElite;
public int NumDays;
public IEnumerable<SelectListItem> PaymentSystems;
}
कार्रवाई:
[HttpPost]
public ActionResult Buy(BuyModel model)
{
return View("BuySummary", model);
}
और जब मैं इसे प्रस्तुत model.IsElite हमेशा गलत है (डिफ़ॉल्ट रूप से)। मुझसे यहां क्या गलत हो रहा है?
सही लग रहा है बाध्य करने के लिए याद रखें। वह हमेशा sux। मुझे संदेह है कि यह ठीक है, लेकिन अपना मॉडल और एक्शन विधि साझा करें। –
Ive ने मेरी पोस्ट अपडेट की। अपना समय देने के लिए धन्यवाद! – CodeDemen
आप गुण नहीं चर –