'how to get only idvalue but oly display textfield in autocomplate in JsonResult?
how to get only idvalue but oly display textfield in autocomplate in JsonResult?
[HttpPost]
public JsonResult AutoComplete(string prefix)
{
var prd = Db.Products.Join(Db.ProductPropertyNumericDetail, p => p.productID, j => j.productID, (p, j) => j)
.Where(j => j.numericPropertyID == 5)
.Select(s => new
{
Text = s.productID + "/ " + s.Products.productName + "/ " + s.propertyValue,
Value = s.productID
}).ToList();
var customers = (from m in prd
where m.Text.Contains(prefix)
select new {id = m.Value.ToString(), name = m.Text });
return Json(customers);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
