问题描述
是否可以使用简单的select
列表将所选选项发送到Controller?还是我需要始终使用@Html.DropDownListFor
?这是我写的,但是不起作用:
控制器:
public ActionResult XYZ(string filterList,int? page)
{
var docsModel = _docs.GetAll();
var model = docsModel
.Where(w => filterList == null || w.docsModel.DECISION == filterList)
.Select(s => new DocumentsModel
{
Comp_name = s.docsModel.NAME,Decision_choice = s.docsModel.DECISION,Manual_date = s.docsModel.MANUAL
})
.OrderBy(o => o.docsModel.DATE).ToPagedList(page ?? 1,15);
return View(model);
}
查看:
@using (Html.BeginForm("XYZ","Home",FormMethod.Get))
{
<th style="border:none">
<select id="filterList" name="filterList" class="form-control textBoxHeaders filtering">
<option value="0" selected></option>
<option value="1">None</option>
<option value="2">Cancellation</option>
<option value="3">Payment date</option>
</select>
</th>
<th>
<input type="submit" value="Filter"/>
</th>
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)