這是一個單選按鈕的例子(有N O):
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%= Html.RadioButton("", "Yes") %> Yes
<%= Html.RadioButton("", "No") %> No
而另一單選按鈕組(性別):
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%= Html.RadioButton("", "Male") %> Male
<%= Html.RadioButton("", "Female") %> Female
而且一個下拉菜單(婚姻狀況):
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%= Html.DropDownList("", new SelectList(new[] {"N/A",
"Single", "Married", "Divorced", "Widowed" })) %>
現在我需要修改這些設置,查找匹配的ViewData [「」]選項列表,或者找出如何將選擇列表傳遞給部分UI模板。
雖然這並不解釋使用EditorFor方法。 – 2011-12-13 20:23:28