1
控制器:DevExpress的組合框在asp.net MVC的SelectedIndexChanged
public ActionResult ComboBox()
{
List<ComboBoxClass> Products = new List<ComboBoxClass>();
Products.Add(new ComboBoxClass { ProductName = "Masa" });
Products.Add(new ComboBoxClass { ProductName = "Sandalye" });
Products.Add(new ComboBoxClass { ProductName = "Bilgisayar" });
Products.Add(new ComboBoxClass { ProductName = "Laptop" });
Products.Add(new ComboBoxClass { ProductName = "Kulaklık" });
Products.Add(new ComboBoxClass { ProductName = "Bardak" });
Products.Add(new ComboBoxClass { ProductName = "Kalem" });
Products.Add(new ComboBoxClass { ProductName = "Seramik" });
Products.Add(new ComboBoxClass { ProductName = "Telefon" });
ViewData["Products"] = Products;
return View(Products);
}
查看:
@Html.DevExpress().ComboBox(
settings =>
{
settings.Name = "BenimComboBox";
settings.Width = 180;
settings.Properties.ValueField = "ProductName";
settings.SelectedIndex = -1;
settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
settings.Properties.DropDownStyle = DropDownStyle.DropDown;
settings.Properties.TextField = "ProductName";
settings.Properties.ValueField = "ProductName";
}
).BindList(ViewData["Products"]).GetHtml()
類
public class ComboBoxClass
{
public string ProductName { get; set; }
}
我products.I列表上的所有產品ComboBox.How能我將我的SelectedIndexChanged值傳遞給ActionResult?
我想看看下面的 「字符串的SelectedItem」
public ActionResult SelectedItemHere(string SelectedItem)
{
// Processes..
return View();
}
Workes完美,除了我不得不做一個小的變化。發佈它以防萬一其他用戶無法運行該功能。 settings.Properties.ClientSideEvents.SelectedIndexChanged =「function(s,e){getData()}」; – nishantvodoo