Twitter bootstrap 3 带引导的MVC5表单
当我还原窗口时,我的窗体看起来很好: 但是如果我把窗户打开,它看起来不太好: 我的查看代码是:Twitter bootstrap 3 带引导的MVC5表单,twitter-bootstrap-3,asp.net-mvc-5,Twitter Bootstrap 3,Asp.net Mvc 5,当我还原窗口时,我的窗体看起来很好: 但是如果我把窗户打开,它看起来不太好: 我的查看代码是: @using System.Collections @using System.Collections.Concurrent @using System.Data.SqlTypes @using DataAccess @using Recaptcha.Web.Mvc @using Recaptcha.Web; @using Recaptcha.Web.Mvc; @model DataAccess
@using System.Collections
@using System.Collections.Concurrent
@using System.Data.SqlTypes
@using DataAccess
@using Recaptcha.Web.Mvc
@using Recaptcha.Web;
@using Recaptcha.Web.Mvc;
@model DataAccess.Employee
@{
ViewBag.Title = "Create";
}
@{ Layout = "/views/shared/_EmployeeLayout.cshtml";
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="container">
<h2>Please, provide some information.</h2>
<div class="row">
<div class="col-md-8">
<div class="form-group">
@Html.LabelFor(model => model.Name, "Name", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.Surname, "Surname", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.Surname, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Surname, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.Location, "Location", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DropDownList("LocationID", null, "--Please pick one--", new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Location, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.Mail, "E-mail", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.Mail, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Mail, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.Telephone, "Telephone number", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.Telephone, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Telephone, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.StartEduYear, "Entrance study year", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DropDownListFor(model => model.StartEduYear, ViewBag.StartYearFaculty as IEnumerable<SelectListItem>, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.StartEduYear, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.EnglishLang.NameLang, "English level", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DropDownList("EngID", null, "--Choose level--", new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.EngID, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.Faculty.FacultyName, "Faculty", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DropDownListFor(model => model.FacultyID, ViewBag.FacultyID as IEnumerable<SelectListItem>, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.FacultyID, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.AvgScore, "Average score", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DropDownListFor(model => model.AvgScore, ViewBag.AverScore as IEnumerable<SelectListItem>, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.AvgScore, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.GradYear, "Graduation year", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DropDownListFor(model => model.GradYear, ViewBag.GradYear as IEnumerable<SelectListItem>, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.GradYear, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.WExp, "Work Experience", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.TextAreaFor(model => model.WExp, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.WExp, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.Interests, "Interests", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.TextAreaFor(model => model.Interests, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Interests, "", new { @class = "text-danger" })
<p></p>
<span>Did you have any additional trainings?</span>
<label for="chkYes">
<input type="radio" id="chkYes" name="chkPassPort" onclick=" ShowHideDiv() " />Yes
</label>
<label for="chkNo">
<input type="radio" id="chkNo" name="chkPassPort" onclick=" ShowHideDiv() " />No
</label>
<div class="form-group" id="dvPassport" style="display: none">
@Html.LabelFor(model => model.Trainings, "Trainings", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextAreaFor(model => model.Trainings, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Trainings, "", new { @class = "text-danger" })
</div>
</div>
<p></p>
<span>Did you have any projects recently?</span>
<label for="chkYes">
<input type="radio" id="chkYes1" name="chkPassPort1" onclick=" ShowHideDiv() " />Yes
</label>
<label for="chkNo">
<input type="radio" id="chkNo1" name="chkPassPort1" onclick=" ShowHideDiv() " />No
</label>
<div class="form-group" id="dvExample" style="display: none">
@Html.LabelFor(model => model.Projects, "Projects", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextAreaFor(model => model.Projects, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.Projects, "", new { @class = "text-danger" })
</div>
</div>
<p></p>
<span>Have you been in some students organization?</span>
<label for="chkYes">
<input type="radio" id="chkYes2" name="chkPassPort2" onclick=" ShowHideDiv() " />Yes
</label>
<label for="chkNo">
<input type="radio" id="chkNo2" name="chkPassPort2" onclick=" ShowHideDiv() " />No
</label>
<div class="form-group" id="dvExample1" style="display: none">
@Html.LabelFor(model => model.StudOrg, "Organizations", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextAreaFor(model => model.StudOrg, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.StudOrg, "", new { @class = "text-danger" })
</div>
</div>
</div>
<div class="form-group">
<div class="g-recaptcha" data-sitekey="6LccVRcTAAAAADLo_LxSj4mQzt9jLrgbo5L9wZ-J"></div>
<div>
@if (TempData["recaptcha"] != null)
{
<p>@TempData["recaptcha"]</p>
}
</div>
</div>
<br />
<br />
<div class="col-md-offset-2 col-md-10">
<b></b>
<div class="form-group">
@Html.Recaptcha()
</div>
<br />
<br />
<br />
<br />
<input type="submit" value="Apply" class="btn btn-default" style="text-align: center" />
</div>
</div>
<p></p>
</div>
</div>
}
<script type="text/javascript">
function ShowHideDiv() {
var chkYes = document.getElementById("chkYes");
var chkYes1 = document.getElementById("chkYes1");
var chkYes2 = document.getElementById("chkYes2");
var dvPassport = document.getElementById("dvPassport");
var dvExample = document.getElementById("dvExample");
var dvExample1 = document.getElementById("dvExample1");
dvPassport.style.display = chkYes.checked ? "block" : "none";
dvExample.style.display = chkYes1.checked ? "block" : "none";
dvExample1.style.display = chkYes2.checked ? "block" : "none";
}
</script>
@使用System.Collections
@使用System.Collections.Concurrent
@使用System.Data.SqlTypes
@使用数据访问
@使用Recaptcha.Web.Mvc
@使用Recaptcha.Web;
@使用Recaptcha.Web.Mvc;
@模型DataAccess.Employee
@{
ViewBag.Title=“创建”;
}
@{Layout=“/views/shared/_EmployeeLayout.cshtml”;
}
@节脚本{
@Scripts.Render(“~/bundles/jqueryval”)
}
@使用(Html.BeginForm())
{
@Html.AntiForgeryToken()
请提供一些信息。
@LabelFor(model=>model.Name,“Name”,htmlAttributes:new{@class=“controllabel col-md-2”})
@EditorFor(model=>model.Name,new{htmlAttributes=new{@class=“form control”})
@Html.ValidationMessageFor(model=>model.Name,“,new{@class=“text danger”})
@LabelFor(model=>model.姓氏,“姓氏”,htmlAttributes:new{@class=“controllabel col-md-2”})
@Html.EditorFor(model=>model.namname,new{htmlAttributes=new{@class=“form control”}})
@Html.ValidationMessageFor(model=>model.namname,“,new{@class=“text danger”})
@LabelFor(model=>model.Location,“Location”,htmlAttributes:new{@class=“controllabel col-md-2”})
@DropDownList(“LocationID”,null,“--请选择一个--”,新的{@class=“form control”})
@Html.ValidationMessageFor(model=>model.Location,“,new{@class=“text danger”})
@LabelFor(model=>model.Mail,“E-Mail”,htmlAttributes:new{@class=“controllabel col-md-2”})
@EditorFor(model=>model.Mail,new{htmlAttributes=new{@class=“form control”})
@Html.ValidationMessageFor(model=>model.Mail,“,new{@class=“text danger”})
@LabelFor(model=>model.phone,“电话号码”,htmlAttributes:new{@class=“controllabel col-md-2”})
@EditorFor(model=>model.Telephone,new{htmlAttributes=new{@class=“form control”}})
@Html.ValidationMessageFor(model=>model.Telephone,“,new{@class=“text danger”})
@LabelFor(model=>model.StartEduYear,“入学学习年”,htmlAttributes:new{@class=“control label col-md-2”})
@Html.DropDownListFor(model=>model.StartEduYear,ViewBag.startyearfunce作为IEnumerable,新的{@class=“form control”})
@Html.ValidationMessageFor(model=>model.StartEduYear,“,new{@class=“text danger”})
@LabelFor(model=>model.EnglishLang.NameLang,“英语水平”,htmlAttributes:new{@class=“control label col-md-2”})
@DropDownList(“EngID”,null,“--Choose level--”,new{@class=“form control”})
@Html.ValidationMessageFor(model=>model.EngID,“,new{@class=“text danger”})
@LabelFor(model=>model.Faculty.FacultyName,“Faculty”,htmlAttributes:new{@class=“control label col-md-2”})
@Html.DropDownListFor(model=>model.FacultyID,ViewBag.FacultyID为IEnumerable,新的{@class=“form control”})
@Html.ValidationMessageFor(model=>model.FacultyID,“,new{@class=“text danger”})
@LabelFor(model=>model.AvgScore,“平均分数”,htmlAttributes:new{@class=“controllabel col-md-2”})
@DropDownListFor(model=>model.AvgScore,ViewBag.core作为IEnumerable,新的{@class=“form control”})
@Html.ValidationMessageFor(model=>model.AvgScore,“,new{@class=“text danger”})
@LabelFor(model=>model.GradYear,“毕业年”,htmlAttributes:new{@class=“controllabel col-md-2”})
@DropDownListFor(model=>model.GradYear,ViewBag.GradYear作为IEnumerable,新的{@class=“form control”})
@Html.ValidationMessageFor(model=>model.GradYear,“,new{@class=“text danger”})
@LabelFor(model=>model.WExp,“工作经验”,htmlAttributes:new{@class=“controllabel col-md-2”})
@text区域(model=>model.WExp,新的{@class=“form control”})
@Html.ValidationMessageFor(model=>model.WExp,“,new{@class=“text danger”})
@LabelFor(model=>model.Interests,“Interests”,htmlAttributes:new{@class=“controllabel col-md-2”})
@Html.TextAreaFor(model=>model.Interests,new{@class=“form control”})
@Html.ValidationMessageFor(model=>model.Interests,“,new{@class=“text danger”})
你有没有接受过额外的培训?
对
不
@LabelFor(model=>model.Trainings,“Trainings”,htmlAttributes:new{@class=“controllabel col-md-2”})
@Html.TextAreaFor(model=>model.Trainings,新{@class=“form control”})
@Html.ValidationMessageFor(model=>model.Trainings,“,new{@class=“text danger”})
你最近有什么项目吗?
对
不
@LabelFor(model=>model.Projects,“Projects”,htmlAttributes:new{@class=“controllabel col-md-2”})
@Html.TextAreaFor(model=>model.Projects,新的{@class=“form control”})
@Html.ValidationMessageFor(model=>model.Projects,”,n
<div class="form-group">
@Html.LabelFor(model => model.Name, "Name", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
</div>