【发布时间】:2020-07-10 18:25:29
【问题描述】:
我可以选择表单中的单选按钮,但我将它们用作按钮组。但是我想将选择的值传递回控制器。但它根本没有发回它只是坐在那里,为什么 btn 组会让表单以这种方式运行。
@using (Html.BeginForm("Create", "Relationships", FormMethod.Post, null)) {
<div class="btn-group" data-toggle="buttons">
<div class="btn-group type-select pull-left top-buffer add-on btn-group-lg" data-toggle="buttons">
<label class="btn btn-primary">
<input type="radio" name="RealtionShipType" data-relationshiptype="1" style="display:none" value="1">
<i class="fa fa-person-booth fa-4x"></i>
</label>
<label class="btn btn-primary">
<input type="radio" name="RealtionShipType" data-relationshiptype="1" value="2">
<i class="fa fa-ship fa-4x"></i>
</label>
<label class="btn btn-primary">
<input type="radio" name="RealtionShipType" Value="3">
<i class="fa fa-location-arrow fa-4x"></i>
</label>
<label class="btn btn-primary">
<input type="radio" name="RealtionShipType" data-relationshiptype="1" value="4">
<i class="fa fa-brain fa-4x"></i>
</label>
<label class="btn btn-primary">
<input type="radio" name="RealtionShipType" data-relationshiptype="1" value="5">
<i class="fa fa-car fa-4x"></i>
</label>
<label class="btn btn-primary">
<input type="radio" name="RealtionShipType" style="display:none" value="5">
<i class="fa fa-mobile fa-4x"></i>
</label>
</div>
<input type="submit" class="btn-success" value="Save And Edit">
</div>
}
我已经为它添加了一个 .net fiddle 作为体验,表单根本不会发布。
【问题讨论】:
标签: c# html twitter-bootstrap asp.net-core razor