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>
        }
    }
}

上記のコードから、4 行のドロップダウン リストが生成されます。問題は、最初のものと最後のものを列スパンにする方法です。スタイル リストに column-span:2 を含めましたが、効果はなく、エラーも発生しないことに注意してください。助けてください。

ここに画像の説明を入力

4

1 に答える 1

2

TD の colspan を設定する必要があります

  <td colspan="2">
    @Html.DropDownList("dropDown_"+item.Code+"_ListName", (IEnumerable<SelectListItem>)ViewData["dropDown_"+item.Code] ,new { style = "width: 100px;" }) 
   </td>   
于 2013-08-28T03:04:29.533 に答える