0
我在MVC2視圖以下代碼:填充並通過複雜的對象從MVC2視圖到控制器動作
<tr class="edit" style="display:none">
<td>
<%= Html.DropDownList("drpFields", new SelectList(Model.Fields, "FieldID", "NiceName", whiteout.FieldID)) %>
</td>
<td>
<%= Html.DropDownList("drpStartTimeh", new SelectList(Model.Hours, whiteout.StartHour.Hour.ToString("0,0")))%>
<%= Html.DropDownList("drpStartTimem", new SelectList(Model.Minutes, whiteout.StartHour.Minute.ToString("0,0")))%>
<%= Html.DropDownList("drpStartTimet", new SelectList(Model.AMPM, whiteout.StartHour.Hour > 12 ? "PM" : "AM"))%>
-
<%= Html.DropDownList("drpEndTime", new SelectList(Model.Hours, whiteout.EndHour.Hour > 12 ? (whiteout.EndHour.Hour - 12).ToString("0,0") : whiteout.EndHour.Hour.ToString("0,0")))%>
<%= Html.DropDownList("drpEndTimem", new SelectList(Model.Minutes, whiteout.EndHour.Minute.ToString("0,0")))%>
<%= Html.DropDownList("drpEndTimet", new SelectList(Model.AMPM, whiteout.EndHour.Hour > 12 ? "PM" : "AM"))%>
</td>
<td>
<%= Html.DropDownList("drprepeat", new SelectList(Model.RepeatList,whiteout.Repeats))%>
</td>
<td>
Active
</td>
<td>
<a class="icon-button-cancel" href='<%: Url.Action("EditWhiteOut", "Settings", new {Id = whiteout.WhiteoutID}) %>'>
<img src='<%: Url.Content("~/static/Images/expanded.png") %>' alt="Delete this device" />
</a>
<a class="icon-button-success" href="#">
<img src="/static/images/gear.png" alt="Edit this device" /></a>
</td>
<td>
</td>
</tr>
我想創建型白化類的一個對象,並與來自下拉菜單由用戶選擇的值來填充它併發送到設置控制器的EditWhiteout操作方法,而不是僅傳遞新的{Id = whiteout.WhiteoutID}。我怎樣才能做到這一點 ?
請建議解決方案。
謝謝。