You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there,
My typeahead remote not showing results. Can any one help?
Here is my Json: {"serials":[{"value":"CXJZ5M1"},{"value":"CXJZ5M2"},{"value":"CXJZ5M3"},{"value":"CXJZ5M4"},{"value":"CXJZ5M5"},{"value":"CXJZ5M6"},{"value":"CXJZ5M7"},{"value":"CXJZ5M8"},{"value":"CXJZ5M9"},{"value":"CXJZ510"}]}
Here is my Controller-Action:
```
public JsonResult SearchAssetSerialsofAssetJson(int id)
{
if (id <= 0) { return Json(new { label = "Invalid Asset" }); }
Configuration conf = _context.Configuration.FirstOrDefault();
if (conf == null)
{
return Json(new { label = "Configuration not found." });
}
if (conf.InventorySystemType == (int)InvetorySystemTypeEnum.LIFO)
{
var serials = (from s in _context.StoreAssetSerial
join st in _context.Store on s.StoreId equals st.Id
join a in _context.Assets on st.AssetId equals a.Id
where s.AssetStatusId == (int)AssetStatusEnum.InStore && st.AssetId == id //&& s.SerialNo.Contains(txtSerial)
orderby s.LabeNo descending
select new
{
value = s.SerialNo
}).Take(10);
return Json(new { serials });
}
else
{
var serials = (from s in _context.StoreAssetSerial
join st in _context.Store on s.StoreId equals st.Id
join a in _context.Assets on st.AssetId equals a.Id
where s.AssetStatusId == (int)AssetStatusEnum.InStore && st.AssetId == id //&& s.SerialNo.Contains(txtSerial)
orderby s.LabeNo ascending
select new
{
value = s.SerialNo
}).Take(10);
return Json(new { serials });
}
}
**Another thing:** How can I pass parameter in the remote: url: (say like, url: `"/Distribution/SearchAssetSerialsofAssetJson?id=" + $(#txtAssetId).text()`)
Thanks in Advance
Tarique Iqbal
Activity