【发布时间】:2016-01-25 15:55:32
【问题描述】:
有什么方法可以在 html 上的同一个单选按钮组中使用多个模型属性,而不会破坏 Razor 用来在提交时获取唯一字段的 Name 字段?
我尝试了以下方法:
<h2>Store or Corporate</h2>
<div class="store-selection-buttons">
<label>Corporate</label>
@Html.RadioButtonFor(model => model.JobPostStatus.IsCorporate, "true")
<label>All Stores</label>
@Html.RadioButtonFor(model => model.JobPostStatus.IsAllStores, "true")
<label>Select Stores</label>
@Html.RadioButton("Store Selection", false, new { @id = "select-stores" })
//This one does other selection work in jquery for individual stores (List<int>)
</div>
【问题讨论】:
-
我听不懂这句话然而Razor 只允许RadioButtonFor 用于参数作为组合功能?
-
我知道如何将参数链接到单选按钮的唯一方法是 RadioButtonFor(),但是您可以将单选按钮链接在一起,因为名称就是参数名称
标签: c# asp.net-mvc razor