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

RadDataPager needs OnPageSizeChanged Event handler

3 Answers 158 Views
DataPager
This is a migrated thread and some comments may be shown as answers.
Mich Meow
Top achievements
Rank 1
Mich Meow asked on 30 Dec 2010, 06:15 PM
For consideration in a future release the RadDataPager should allow registration to an OnPageSizeChanged event. I am handling the databinding and paging in code behind going through a WCF tier; however, I had to remove the change PageSize functionality from the end user because this event doesn't exist.

The Functionality should be like this to mirror the PageIndexChanged event:

ASPX:

                <telerik:RadDataPager ID="RadDataPager1" runat="server" OnPageIndexChanged="RadDataPager1_PageIndexChanged"
                    OnTotalRowCountRequest="RadDataPager1_TotalRowCountRequest"
    OnPageSizeChanged="RadDataPager1_PageSizeChanged" Skin="Windows7">
                   ...
                </telerik:RadDataPager>

Code Behind:

    protected void RadDataPager1_PageSizeChanged(object sender, RadDataPagerPageSizeChangeEventArgs e)
    {
        int NewPageSize = e.NewPageSize;
...
    }

Cheers,
Andrew.


   

3 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay Rusev
Telerik team
answered on 05 Jan 2011, 02:15 PM
Hello Andrew,

You can handle OnCommand event of RadDataPager and listen for  RadDataPager.PageSizeChangeCommandName. For example:

Pager.Command += (s, a) =>
{
  if (a.CommandName == RadDataPager.PageSizeChangeCommandName)
  {
    var oldValue = Pager.PageSize;
    var newValue = Convert.ToInt32(a.CommandArgument);
  }
};


Regards,
Nikolay
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Mich Meow
Top achievements
Rank 1
answered on 05 Jan 2011, 07:59 PM
Thanks very much Nikolay, That worked perfectly for me.

Cheers,
Andrew.
0
Michael
Top achievements
Rank 1
answered on 14 Oct 2013, 03:53 PM
I found that If I wanted the pager's PageSize property to actually reflect the selected value during the subsequent page render (as opposed to at the end of the render), I had to set it myself, to wit:

if (e.CommandName == RadDataPager.PageSizeChangeCommandName)
{
    (sender as RadDataPager).PageSize = Convert.ToInt32(e.CommandArgument);
}
Tags
DataPager
Asked by
Mich Meow
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Mich Meow
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Share this question
or