ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Persist grid page size across session in all grids
Title:
B
I
{code}
?
Is it possible to persist the selected pageSize so that when it changes, the new pageSize is applied to all grids? Currently, I am saving the GridParams PageSize (g.PageSize) in ViewData and then setting the grid's .PageSize() property to the ViewData value. This works fine when the grid initially refreshes, but if I refresh the page, or load another page with a grid, it reverts back to the default 10. This makes it difficult to know whether g.PageSize is actually a change based on user selecting a new page size or just reloading the default value.
Save Changes
Cancel
stevec50
asked at 13 Oct 2019
Answers
B
I
{code}
?
you could save the latest `g.PageSize` in a session variable Session["ps"] = g.PageSize; and in the markup set @Html.Awe().Grid("grid1") .PageSize((int?) Session["ps"] ?? 10) and you can choose to use this code on all grids or just a few
Save Changes
Cancel
Omu
answered at 13 Oct 2019
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