我有一个表单,我想在Html.TextBoxFor
到标签的地方可以吗?
@* title *@
<div class="form-group">
<label class="control-label col-md-4">Song Title</label>
<div class="col-md-4">
@foreach (var t in Model.OriginalWork.AlternativeTitles)
{<label class="control-label text-muted">@t.Title</label>
}
</div>
</div>
@* Alternative Titles *@
<div class="form-group">
@Html.LabelFor(m => m.OriginalWork.AlternativeTitles, new { @class = "control-label col-md-4" })
<div class="col-md-8">
<div class="row">
<div class="tag-container tags col-md-12" data-bind="foreach: AlternateTitles">
@foreach (var t in Model.OriginalWork.AlternativeTitles)
{<span class="tm-tag tm-tag-info" data-bind="hidden: IsDeleted">
@t.Title
</span>
}
</div>
</div>
</div>
</div>
@* Duration *@
<div class="form-group mbn">
<label class="control-label col-md-4 pull-left hidden-sm" for="DurationMinutes">Duration</label>
<div class="col-md-1 mb15">
@Html.LabelFor(m => m.OriginalWork.DurationMins, new { @class = "control-label pull-left hidden-md hidden-lg hidden-xl" })
@Html.TextBoxFor(m => m.OriginalWork.DurationMins, new { @class = "form-control isDisabled", placeholder = "Mins...", data_bind = "value: DurationMins" })
@Html.ValidationMessageFor(m => m.OriginalWork.DurationMins, string.Empty, new { @class = "text-danger" })
</div>
<div class="col-md-1 mb15">
@Html.LabelFor(m => m.OriginalWork.DurationSecs, new { @class = "control-label pull-left hidden-md hidden-lg hidden-xl" })
@Html.TextBoxFor(m => m.OriginalWork.DurationSecs, new { @class = "form-control isDisabled", placeholder = "Secs...", data_bind = "value: DurationSecs" })
@Html.ValidationMessageFor(m => m.OriginalWork.DurationSecs, string.Empty, new { @class = "text-danger" })
</div>
</div>
@* Performing Artists *@
<div class="form-group">
@Html.LabelFor(m => m.OriginalWork.PerformingArtistNames, new { @class = "control-label col-md-4" })
<div class="col-md-8">
<div class="row">
<div class="tag-container tags col-md-12" data-bind="foreach: PerformingArtistNames">
@foreach (var t in Model.OriginalWork.PerformingArtistNames)
{<span class="tm-tag tm-tag-info" data-bind="hidden: IsDeleted">
@t.Firstname @t.Lastname
</span>
}
</div>
</div>
</div>
</div>
@* remix and samples *@
<div class="form-group">
@Html.LabelFor(m => m.OriginalWork.IsRemix, new { @class = "control-label col-md-4" })
<div class="col-md-8">
<div class="admin-form theme-primary">
<div class="radio-custom radio-primary mt10 mr10 pull-left">
@Html.RadioButtonFor(m => m.OriginalWork.IsRemix, true, new { @class = "control-label col-md-4" })
<label for="IsRemixYes">Yes</label>
</div>
<div class="radio-custom radio-primary mt10 pull-left">
@Html.RadioButtonFor(m => m.OriginalWork.IsRemix, false, new { @class = "control-label col-md-4" })
<label for="IsRemixNo">No</label>
</div>
</div>
</div>
</div>
@*Contains Sample Radio Button*@
<div class="form-group">
@Html.LabelFor(m => m.OriginalWork.ContainsSample, new { @class = "control-label col-md-4" })
<div class="col-md-8">
<div class="admin-form theme-primary">
<div class="radio-custom radio-primary mt10 mr10 pull-left">
@Html.RadioButtonFor(m => m.OriginalWork.ContainsSample, true, new { @class = "control-label col-md-4" })
<label for="ContainsSampleYes">Yes</label>
</div>
<div class="radio-custom radio-primary mt10 pull-left">
@Html.RadioButtonFor(m => m.OriginalWork.ContainsSample, false, new { @class = "control-label col-md-4" })
<label for="ContainsSampleNo">No</label>
</div>
</div>
</div>
</div>
@* ISWC *@
<div class="form-group">
@Html.LabelFor(m => m.OriginalWork.Iswc, new { @class = "control-label col-md-4" })
<div class="col-md-4">
@Html.TextBoxFor(m => m.OriginalWork.Iswc, new { @class = "form-control isDisabled", placeholder = "ISWC", data_bind = "value: Iswc" })
@Html.ValidationMessageFor(m => m.OriginalWork.Iswc, string.Empty, new { @class = "text-danger" })
</div>
</div>
</div>
</fieldset>
答案 0 :(得分:1)
如果要禁用单选按钮(假设您使用的是razor语法),则可以使用:
@Html.RadioButtonFor(m => m.SomeModelItem, "false")
这应该使您走上正确的轨道。