私はこれを見ました:
そして、私のDateTime []をビューのドロップダウンリストとして展開するのに苦労していますが、これは私の行ですが、正しくありません。
<p style="color:Red"><%: Html.DropDownList("Choose a Sunday: ", (IEnumerable<SelectListItem>)ViewData["Sundays"], "--Select--")%>
</p>
コントローラーで私は持っています:
[HttpGet]
public ActionResult MyAction()
{
DateTime[] allSundaysInMonth = GetDatesOfSundays(System.DateTime.Now);
ViewData["Sundays"] = allSundaysInMonth;
return View();
}
誰か助けてもらえますか?ありがとう