Tuesday, 27 August 2013

Column-Span in ASP.NET MVC View

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.
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. Please help.

No comments:

Post a Comment