当用户从任何一个下拉列表中选择某个值时,我需要将三个下拉列表中的值传递给控制器。我尝试过这样,但仅传递所选下拉列表中的值,其他值为空值,任何帮助将不胜感激。
看法
@@using (Html.BeginForm("GetFilterValues","Home",FormMethod.gET))
{
@Html.DropDownList("FClass", ViewBag.Market as SelectList, new { id = "Market" , onchange = "$(this).parents('form').submit();" })
}
@using (Html.BeginForm("GetFilterValues","Home",FormMethod.Get))
{
@Html.DropDownList("FClass", ViewBag.Class as SelectList, new { id = "FClass" , onchange = "$(this).parents('form').submit();" })
}
</td>
<td>
@Html.Label("Status")
</td>
<td>
@using (Html.BeginForm("GetFilterValues","Home",FormMethod.Get))
{
@Html.DropDownList("Status", ViewBag.Status as SelectList, new { id = "Status" , onchange = "$(this).parents('form').submit();" })
}
控制器 [Httpget]
public void GetFilterValues()
{
string market = this.Request.Form.Get("Market");
string fclass = this.Request.Form.Get("FClass");
string status = this.Request.Form.Get("Status");
}