This is a migrated thread and some comments may be shown as answers.

[Solved] Could not set PageSize dynamically through application.

1 Answer 158 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mahendran
Top achievements
Rank 1
Mahendran asked on 25 Jun 2012, 04:05 PM
I wanted to set the value that I have from session on PageSize. so that if user set the page size to something.. after drilling down and coming back to this page, he should see the number of records he originally wanted to see instead of some original value set.

example: if the default page size is 20, later on user changes it to 50. after drilling down by clicking on the links on the records, say it goes some other page and if you come back to this page where we have this grid. it sets the page size back to 20 instead of 50. Do you know what I have to do here to get this fixed?

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 28 Jun 2012, 08:39 AM
Hello Mahendran,

You can handle the Grid's OnLoad event (if using server binding) or OnDataBound (client binding) and store the current pagesize in a cookie by using

$("#Grid-ID").data("tGrid").pageSize

Afterwards, when returning to this view, set the PageSize server-side by using the stored cookie information.

.Pageable(paging => paging.PageSize(ViewBag.PageSizeInfo))

Regards,
Dimo
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
Tags
Grid
Asked by
Mahendran
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or