Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi..i am beginner in mvc. am trying to set autocomplete a textbox in mvc4 razor.. my project done by using entity frame work model... i want to autocomplete my textbox that refers from a table of all columns values.. my issue is am only getting single column values. i want to know how to get all value from a table( all columns values) in textbox during autocomplete section. kindly help me to fix this. thanks


my code is:

public JsonResult Getbusiness(string term)
{
MvcApplication1Entities1 db = new MvcApplication1Entities1();
List<string> business;
{
business = db.tblBusinessCategories.Where(x => x.BusinessName.StartsWith(term))
.Select(y => y.BusinessName).ToList();
}
return Json(business, JsonRequestBehavior.AllowGet);
}
Posted
Comments
Sreekanth Mothukuru 27-Jun-15 2:49am    
Apply where clause on all the columns that you want to be part of the filter criteria.

1 solution

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