tags:

views:

231

answers:

2

We need to save the selected new page size to a session.

We have tried the PageSizeChanged event but the NewPageSize returns 0.

Is there a way we could get the new page size value? How? Thanks.

A: 

I was able to get what I need by

protected void Page_Load(object sender, EventArgs e) {
    int newPageSize = ((RadDataPager)RadListView1.FindControl("RadDataPager1")).PageSize;
    if ((int)Session["ImagesPerPage"] != newPageSize) {
        Session["ImagesPerPage"] = newPageSize;
    }
    RadListView1.PageSize = (int)Session["ImagesPerPage"];
}

This seems kind of hack. Any other more elegant ways to do this?

Jronny
A: 

How about using the DataBound event of the listview for the same purpose? It seems the more appropriate place to store the page size in cache or session than each time on PageLoad.

Dick Lampard
I actually intended this on Page_Load since there are still other items needed inside the function.
Jronny