ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Avoid sorting in Grid
Title:
B
I
{code}
?
I am providing sorting to my records from database side, but still records shown on grid are not displayed in order as passed from Database My controller is :- [HttpPost] public ActionResult GetGridItems(GridParams g, string search) { search = (search ?? "").ToLower(); List<Document> documentList = null; ApplicationExceptionHandler.Handle(() => { ServiceProcessComponent.Use<MasterServiceClient>(Service => { documentList = Service.GetAllDocuments().ToList(); }); }); var items = documentList.Where( o => (!string.IsNullOrEmpty(o.DocumentName) && o.DocumentName.ToLower().Contains(search)).AsQueryable(); var objMasterClient = new MasterServiceClient(); var data = new GridModelBuilder<Document>(items, g) { Key = "DocumentID", / GetItem = () => objMasterClient.GetDocumentByID(UserID, LangID, Convert.ToInt32(g.Key)), Map = d => new { d.DocumentID, d.DocumentName, d.Description } }.Build(); return Json(data); } and my view is : - @(Html.Awe().Grid("CheckListGrid") .Mod(o => o.PageInfo().PageSize().ColumnsSelector()) .Url(Url.Action("GetGridItems", "CheckListDocument")) .Parent("txtSearch", "search") .Parent("id", "id") .Parent("values", "values") .Persistence(Persistence.View) .Resizable(true) .Groupable(false) .Columns(columns.ToArray()))
Save Changes
Cancel
Tanuj Shrivastava
asked at 03 Aug 2016
you need to set PageCount and ItemsCount as shown here: http://demo.aspnetawesome.com/GridDemo/CustomQuerying, this way the GridModelBuilder won't query your data
at 03 Aug 2016
Omu
Answers
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK