1
@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.

enter image description here

tereško
  • 58,060
  • 25
  • 98
  • 150
SuicideSheep
  • 5,260
  • 19
  • 64
  • 117

1 Answers1

2

You need to set the colspan for the TD

  <td colspan="2">
    @Html.DropDownList("dropDown_"+item.Code+"_ListName", (IEnumerable<SelectListItem>)ViewData["dropDown_"+item.Code] ,new { style = "width: 100px;" }) 
   </td>   
Nilesh
  • 2,583
  • 5
  • 21
  • 34