2013-08-28 1 views
0
@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> 
     } 
    } 
} 

위의 코드에서 4 행의 드롭 다운 목록이 생성됩니다. 문제는 첫 번째 열과 마지막 열을 열로 만드는 방법입니다. 스타일 목록에 column-span : 2를 포함 시켰지만 효과가 없으며 오류가 발생하지 않습니다. 도와주세요.ASP.NET MVC의 열 범위보기

enter image description here

답변

1

당신은 TD

<td colspan="2"> 
    @Html.DropDownList("dropDown_"+item.Code+"_ListName", (IEnumerable<SelectListItem>)ViewData["dropDown_"+item.Code] ,new { style = "width: 100px;" }) 
    </td> 
의 열 병합을 설정해야