我有一个相当不寻常的问题。我有一个视图结构,它在表格上具有以下格式:
<table class="smartTable">
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.Case_Status, new { @id = "caseStatus", @Value = "In Progress", @readonly = "true", htmlAttributes = new { @class = "form-control" } })
<tr>
<td width="33.33%">
<div class="form-group">
@Html.LabelFor(model => model.Job_Name, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Job_Name, new { htmlAttributes = new { @class = "form-control" } })
<br />
@Html.ValidationMessageFor(model => model.Job_Name, "", new { @class = "text-danger" })
</div>
</div>
<td>
<td width="33.33%">
<div class="form-group">
@Html.LabelFor(model => model.Package_Name, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Package_Name, new { htmlAttributes = new { @class = "form-control" } })
<br />
@Html.ValidationMessageFor(model => model.Package_Name, "", new { @class = "text-danger" })
</div>
</div>
<td>
<td width="33.33%">
<div class="form-group">
@Html.LabelFor(model => model.Server_Name, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="dropdown">
@Html.DropDownListFor(model => model.Server_Name, (IEnumerable<SelectListItem>)ViewBag.SrvNames, "Pick an option")
<br />
@Html.ValidationMessageFor(model => model.Server_Name, "", new { @class = "text-danger" })
</div>
</div>
</td>
</tr>
</table>
我有几个这样的表(我不想改变格式)。问题是,当我的视图加载时,我已经在代码中放置的三个<td>
之间有空<td>
个标记。它只发生在两个表中,而idk为什么。
有人知道导致这种奇怪行为的原因是什么吗?
PS:我网站的先前版本没有此问题。我没有jQuery搞乱表格结构。
答案 0 :(得分:0)
看看你的最后一个td里面的div 关闭SelectListItem 这样的标签
@ Html.DropDownListFor(model =&gt; model.Server_Name,(IEnumerable)ViewBag.SrvNames,“选择一个选项”)