0
当用户从dropdownlist中选择一些值时,我需要将三个下拉列表中的值传递给控制器。我尝试这样做,但只传递所选下拉列表中的值,其他值为空值,任何帮助都会不胜感激。MVC4 Dropdownlist
VIEW
@@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");
}
您是否尝试过使用招看到的是实际发送的是什么? – anthonybell 2013-04-21 02:10:53
你希望他们都在一种形式。否则他们不会一起提交。 – 2013-04-21 02:22:08
@DaveA会试试看看谢谢 – Lav 2013-04-21 02:55:32