Choice
NotApplicable
public class Answer { public bool NotApplicable { get; set; } [Range(1, 5, ErrorMessage = "Choice must be 1-5")] public int Choice { get; set; } }
@using (Html.BeginForm()) { @Html.AntiForgeryToken() <div class="form-horizontal"> @Html.ValidationSummary(true, "", new { @class = "text-danger" }) <div class="form-group"> @Html.LabelFor(model => model.NotApplicable, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> <div class="checkbox"> @Html.EditorFor(model => model.NotApplicable) @Html.ValidationMessageFor(model => model.NotApplicable, "", new { @class = "text-danger" }) </div> </div> </div> <div class="form-group"> @Html.LabelFor(model => model.Choice, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @for (Int32 opt = 1; opt < 7; opt++) { <div> @Html.Label(opt.ToString()) @Html.RadioButtonFor(model => model.Choice, opt) </div> } @Html.ValidationMessageFor(model => model.Choice, "", new { @class = "text-danger" }) </div> </div> <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="Create" class="btn btn-default" /> </div> </div> </div> }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)