[英]Column-Span in ASP.NET MVC View
@foreach (var item in Model) {
@if(ViewData["dropDown_"+item.Code] != null){
if (item.Code == "1" || item.Code == "4")
{
<td>
@Html.DropDownList("dropDown_"+item.Code+"_ListName", (IEnumerable<SelectListItem>)ViewData["dropDown_"+item.Code] ,new { style = "width: 100px; column-span: 2;" })
</td>
}else{
<td>
@Html.DropDownList("dropDown_"+item.Code+"_ListName", (IEnumerable<SelectListItem>)ViewData["dropDown_"+item.Code] ,new { style = "width: 100px;" })
</td>
<td>
Owner Preference: GREEN
</td>
}
}
}
From the above code, there will be 4 rows of dropdownlist be generated. 从上面的代码中,将生成4行dropdownlist。 The question is how to make the first one and the last one to column span.
问题是如何使第一个和最后一个跨到列范围。 Note that I've included column-span:2 in the style list, but it has no effect nor giving any errors.
请注意,我已经在样式列表中包括了column-span:2,但是它没有任何作用,也没有给出任何错误。 Please help.
请帮忙。
You need to set the colspan for the TD 您需要为TD设置colspan
<td colspan="2">
@Html.DropDownList("dropDown_"+item.Code+"_ListName", (IEnumerable<SelectListItem>)ViewData["dropDown_"+item.Code] ,new { style = "width: 100px;" })
</td>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.