に列挙ラジオボタンでは動作しません。私は、列挙型を持っていますクライアント側の検証は、MVC
<div id="kind-of-deal">
@Html.ValidationMessageFor(model => model.KindOfDeal, null, htmlAttributes: new { @class = "ErrorMessageForInputs" })
<div class="A7O-wrapr-radio">
@Html.RadioButtonFor(model => model.KindOfDeal, (int)KindOfDeal.BuyIt, htmlAttributes: new { @class = "A7O-radio", id = "p-purchase" })
@Html.Label("p-purchase", "", new { @class = "A7O-label-radio", data_icon = " " })
</div>
<div class="A7O-wrapr-radio">
@Html.RadioButtonFor(model => model.KindOfDeal, (int)KindOfDeal.SaleIt, htmlAttributes: new { @class = "A7O-radio", id = "p-sale" })
@Html.Label("p-sale", "", new { @class = "A7O-label-radio", data_icon = " " })
</div>
<div class="A7O-wrapr-radio rel" id="parent-rentPresenter">
@Html.RadioButtonFor(model => model.KindOfDeal, (int)KindOfDeal.RentIt, htmlAttributes: new { @class = "A7O-radio", id = "p-rent-presenter" })
@Html.Label("p-rent-presenter", "", new { @class = "A7O-label-radio", data_icon = " " })
</div>
<div class="A7O-wrapr-radio rel">
@Html.RadioButtonFor(model => model.KindOfDeal, (int)KindOfDeal.WantRent, htmlAttributes: new { @class = "A7O-radio", id = "p-rent-wanted" })
@Html.Label("p-rent-wanted", "", new { @class = "A7O-label-radio", data_icon = " " })
</div>
<div class="A7O-wrapr-radio">
@Html.RadioButtonFor(model => model.KindOfDeal, (int)KindOfDeal.ExchangeIt, htmlAttributes: new { @class = "A7O-radio", id = "p-exchange-presenter" })
@Html.Label("p-exchange-presenter", "", new { @class = "A7O-label-radio", data_icon = " " })
</div>
<div class="A7O-wrapr-radio">
:次のようにCSHTMLファイルのラジオボタンを作成します
validate.jsとvalidate.unobtrusive.jsが私のcshtmlファイルで参照されていました。さらに、この列挙型をnullable Requiredプロパティとして作成します。サーバー側の検証は、これらの列挙型ラジオボタンで正常に機能します。また、クライアント側の検証は、これらの列挙型ラジオボタン以外の他のhtml入力要素に対してもうまく機能します。
は[こちら](http://stackoverflow.com/questions/25548796/how-to-make-requiredattribute-work-with-an-enum-field)あなたの貢献のための –
感謝を参照してください。しかし、私は2番目のアプローチ – Xeta7
この質問の任意のヘルプによって任意の結果を得なかった? – Xeta7