Я хочу использовать два переключателя, чтобы проверить, является ли тип регистрации пользователя клиентом или бизнесом. Поэтому для этого я закодировал файл View.cshtml, как на
этом изображении
Но я получаю неожиданный результат. Он не отображает переключатель. вместо этого отображается только текст
Вот мой код:
@model FoodieWeb.Models.UsersModel
@{
ViewBag.Title = "UserRegister";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@using (Html.BeginForm("UserRegister", "UserRegister", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Register as a new Member</h4>
<hr />
@Html.ValidationSummary("", new { @class = "text-danger" })
<div class="form-group">
<label for="email" class="col-md-2 control-label">Email*</label>
<div class="col-md-10">
@Html.EditorFor(model => model.email, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.email)
</div>
</div>
<div class="form-group">
<label for="fname" class="col-md-2 control-label">First Name*</label>
<div class="col-md-10">
@Html.EditorFor(model => model.fname)
@Html.ValidationMessageFor(model => model.fname)
</div>
</div>
<div class="form-group">
<label for="lname" class="col-md-2 control-label">Last Name*</label>
<div class="col-md-10">
@Html.EditorFor(model => model.lname)
@Html.ValidationMessageFor(model => model.lname)
</div>
</div>
<div class="form-group">
<label for="phone" class="col-md-2 control-label">Phone*</label>
<div class="col-md-10">
@Html.EditorFor(model => model.phone)
@Html.ValidationMessageFor(model => model.phone)
</div>
</div>
@*<div class="form-group">
@Html.LabelFor(model => model.photo, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.EditorFor(model => model.photo)
@Html.ValidationMessageFor(model => model.photo)
</div>
</div>*@
<div class="form-group">
<label for="address" class="col-md-2 control-label">Address*</label>
<div class="col-md-10">
@Html.EditorFor(model => model.address)
@Html.ValidationMessageFor(model => model.address)
</div>
</div>
<div class="form-group">
<label for="city" class="col-md-2 control-label">City*</label>
<div class="col-md-10">
@Html.EditorFor(model => model.city)
@Html.ValidationMessageFor(model => model.city)
</div>
</div>
<div class="form-group">
<label for="postcode" class="col-md-2 control-label">Post Code*</label>
<div class="col-md-10">
@Html.EditorFor(model => model.postcode)
@Html.ValidationMessageFor(model => model.postcode)
</div>
</div>
<div class="form-group">
<label for="district" class="col-md-2 control-label">District*</label>
<div class="col-md-10">
@Html.EditorFor(model => model.district)
@Html.ValidationMessageFor(model => model.district)
</div>
</div>
<div class="form-group">
<label for="user_type" class="col-md-2 control-label">User Type*</label>
<div class="col-md-10">
@Html.RadioButtonFor(model => model.user_type, "Customer")
@Html.RadioButtonFor(model => model.user_type, "Business")
@*@Html.EditorFor(model => model.user_type)*@
@Html.ValidationMessageFor(model => model.user_type)
</div>
</div>
<div class="form-group">
<label for="status" class="col-md-2 control-label">Status*</label>
<div class="col-md-10">
@Html.EditorFor(model => model.status)
@Html.ValidationMessageFor(model => model.status)
</div>
</div>
<div class="form-group">
<label for="created_date" class="col-md-2 control-label">Created Date*</label>
<div class="col-md-10">
@Html.EditorFor(model => model.created_date)
@Html.ValidationMessageFor(model => model.created_date)
</div>
</div>
<div class="form-group">
<label for="password" class="col-md-2 control-label">Password*</label>
<div class="col-md-10">
@Html.EditorFor(model => model.password)
@Html.ValidationMessageFor(model => model.password)
</div>
</div>
<div class="form-group">
<label for="confirm_password" class="col-md-2 control-label">Confirm Password*</label>
<div class="col-md-10">
@Html.EditorFor(model => model.confirm_password)
@Html.ValidationMessageFor(model => model.confirm_password)
</div>
</div>
<div class="form-group">
<div class="col-md-10">
<label>
<input id="agree" type="checkbox" name="agree" checked value="true" />
@*@Html.CheckBox("agree", true)*@
@*@Html.CheckBoxFor(model => model.agree)I agree to the terms and conditions.
@Html.ValidationMessageFor(model => model.agree)*@
</label>
</div>
</div>
<div class="form-group" style="visibility:visible">
<div class="col-md-offset-2 col-md-10" style="visibility:visible">
<input type="submit" class="btn btn-primary" />
</div>
</div>
</div>
}
<div>
@*@Html.ActionLink("Back to List", "Index")*@
@Html.ActionLink("Already Registered?", "UserLogin", "UserLogin")
</div>
enter code here
c#,asp.net-mvc,entity-framework,