hi to all,
Here i done searching for autocomplete textbox .
Let us consider now i have total pages 10, now i filter respective record in table then i will filter as per given information and that have 5 pages . if i click 2 nd from filtering record pages then total page should be refreshing again i got 10 pages
Here i used this code:
In controller:
public JsonResult SearchAutoCompleter(string term ,string Branchlist,int? page)
{
var myObjects = (from o in db.Branches
join cou in db.Country on o.Country_Id equals cou.Country_Id
where o.Branch_Name.Contains(term)||cou.Country_Name.Contains(term)
select new
{
label = o.Branch_Name,o.Country_Id
}).Distinct().Take(3);
ViewBag.term = myObjects;
return Json(myObjects, JsonRequestBehavior.AllowGet);
}
In index using Ajax function:-
$(document).ready(function () {
$("#autocomplete").autocomplete({
source: "@Url.Action("SearchAutoCompleter","Branch")",
messages: {
noResults: 'no result found',
results: function () { }
}
});
});
Design:-
@Html.TextBox("SearchName", ViewBag.branch_Name as string, new { @id = "autocomplete" })
if u not understand kindly let me know. Here i want to set paging for filtered record
Nimit JoshiPosted Aug 22, 2014, 5:12 AM
http://www.c-sharpcorner.com/UploadFile/4b0136/perform-paging-searching-sorting-in-Asp-Net-mvc-5/