ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Turn off item count in Grid
Title:
B
I
{code}
?
I have a grid accessing a table with 20+ million rows. It's sending a count command that takes too long to return. Can I turn off the item count in the grid and avoid the call to count the items?
Save Changes
Cancel
David Austin
asked at 31 Jan 2016
the count is necessary for generating the pager; you could turn it off by setting PageCount as shown here: http://demo.aspnetawesome.com/GridDemo/CustomQuerying, but this will also turn off the sorting and paging, so you'll have to sort and page the items yourself before passing them to the GridModelBuilder
at 31 Jan 2016
Omu
Thank you, this works fine. I simply removed the counting by assigning static valies: return new GridModelBuilder<Order>(items, g) { Key = "import_id", Map = MapToGridModel, PageCount = 1, ItemsCount = 10 }.Build();
at 31 Jan 2016
David Austin
what about paging/sorting ? are you only showing the first page of a search result ? you can set g.Paging = false; if you don't need the pager
at 31 Jan 2016
Omu
Thanks, g.Paging = false; works and is more elegant.
at 01 Feb 2016
David Austin
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