如何在MVC中的Controller中獲取DropDownList SelectedValue我有下拉列表,我已從數(shù)據(jù)庫中填寫?,F(xiàn)在我需要在Controller中獲取所選值進行一些操作。但沒有得到這個想法。我試過的代碼。模型public class MobileViewModel {
public List<tbInsertMobile> MobileList;
public SelectList Vendor { get; set; }}調(diào)節(jié)器 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 回答
- 0 關注
- 1292 瀏覽
添加回答
舉報
0/150
提交
取消