Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to pass two parameter(string term,string vouvhertype) in jqgrid autocomplete textbox in edit form .So that data for autocomplete get filtered according to the second parameter.

public JsonResult GetSubAccountForAutocompleteDrCode(string term,string Vtype)
{
if (Vtype == "BP" || Vtype == "CP")
{
string v = Vtype.Remove(1, 1);
FMS_BLL.Account_SubAccountDetails[] matching = string.IsNullOrWhiteSpace(term) ?
Account_SubAccountDetailsHelper.GetSubAccountMasterDetailsForAutoCompleteWithFilter(v).ToArray() :
Account_SubAccountDetailsHelper.GetSubAccountMasterDetailsForAutoCompleteWithFilter(v).Where(p => p.ACCOUNT_NAME != null && p.ACCOUNT_NAME.ToUpper().Trim().StartsWith(term.ToUpper().Trim())).ToArray();

return Json(matching.Select(m => new { id = m.ACCOUNT_CODE, value = m.ACCOUNT_CODE + "-" + m.ACCOUNT_HEAD_CODE + "-" + m.ACCOUNT_NAME + "-" + m.ACCOUNT_DESCRIPTION + "-" + m.ACCOUNT_TYPE, label = m.ACCOUNT_CODE + "-" + m.ACCOUNT_HEAD_CODE + "-" + m.ACCOUNT_NAME + "-" + m.ACCOUNT_DESCRIPTION }), JsonRequestBehavior.AllowGet);
}
else
{
FMS_BLL.Account_SubAccountDetails[] matching = string.IsNullOrWhiteSpace(term) ?
Account_SubAccountDetailsHelper.GetSubAccountMasterDetailsForAutoComplete().ToArray() :
Account_SubAccountDetailsHelper.GetSubAccountMasterDetailsForAutoComplete().Where(p => p.ACCOUNT_NAME != null && p.ACCOUNT_NAME.ToUpper().Trim().StartsWith(term.ToUpper().Trim())).ToArray();

return Json(matching.Select(m => new { id = m.ACCOUNT_CODE, value = m.ACCOUNT_CODE + "-" + m.ACCOUNT_HEAD_CODE + "-" + m.ACCOUNT_NAME + "-" + m.ACCOUNT_DESCRIPTION + "-" + m.ACCOUNT_TYPE, label = m.ACCOUNT_CODE + "-" + m.ACCOUNT_HEAD_CODE + "-" + m.ACCOUNT_NAME + "-" + m.ACCOUNT_DESCRIPTION }), JsonRequestBehavior.AllowGet);
}
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900