當我單擊提交按鈕時,請幫助我獲取控制器中下拉列表的選定值。在MVC3 Razor中獲取下拉列表值
My view is like
@using (Html.BeginForm())
{
@foreach (var department in @Model)
{
items.Add(new SelectListItem
{
Text = @department.DeptName,
Value = @department.DeptId.ToString()
});
}
@Html.DropDownList("deptID", items, "--Select One--", new { @style = width:160px" }) *
<input type="submit" name="Filter" value="filter" />
}
Please share if you are having any website link which explains about the dropdown list and its events in mvc3 Razor.
感謝 聖
參數爲您結合MVC交易做正確的方式http://stackoverflow.com/questions/4674033/mvc-3-layout-page-razor-template-and-dropdownlist/4678786#4678786 – Tsar 2011-06-17 09:20:59
這跟剃刀真的沒什麼關係 – fearofawhackplanet 2011-06-17 09:30:58
謝謝不好顯示名稱我會去做:) – san 2011-06-17 09:58:10