如何在MVC中的Controller中获取DropDownList SelectedValue我有下拉列表,我已从数据库中填写。现在我需要在Controller中获取所选值进行一些操作。但没有得到这个想法。我试过的代码。模型public class MobileViewModel {
public List<tbInsertMobile> MobileList;
public SelectList Vendor { get; set; }}调节器 public ActionResult ShowAllMobileDetails()
{
MobileViewModel MV = new MobileViewModel();
MV.MobileList = db.Usp_InsertUpdateDelete(null, "", "", null, "", 4, MergeOption.AppendOnly).ToList();
MV.Vendor = new SelectList(db.Usp_VendorList(), "VendorId", "VendorName");
return View(MV);
}
[HttpPost]
public ActionResult ShowAllMobileDetails(MobileViewModel MV)
{
string strDDLValue = ""; // Here i need the dropdownlist value
return View(MV);
}视图 <table>
<tr>
<td>Mobile Manufacured</td>
<td>@Html.DropDownList("ddlVendor", Model.Vendor, "Select Manufacurer") </td>
</tr>
<tr>
<td>
</td>
<td>
<input id="Submit1" type="submit" value="search" />
</td>
</tr>
</table>
3 回答
- 3 回答
- 0 关注
- 1264 浏览
添加回答
举报
0/150
提交
取消