public ActionResult Index(tb_SalesOrder model) { if (!string.IsNullOrEmpty(model.SearchButton) || model.Page.HasValue) { var entities = new Demo_onlineEntities(); var results = entities.tb_SalesOrder.Where(p => (p.Bill_No == model.Bill_No)).OrderBy(p => p.ID_Product); var pageIndex = model.Page ?? 1; model.SearchResults = results.ToPagedList(pageIndex, RecordsperPage); } return(View(model)); }