RadDataPager needs OnPageSizeChanged Event handler

4 posts, 1 answers
  1. Mich Meow
    Mich Meow avatar
    6 posts
    Member since:
    Jan 2010

    Posted 30 Dec 2010 Link to this post

    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.


       
  2. Answer
    Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 05 Jan 2011 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mich Meow
    Mich Meow avatar
    6 posts
    Member since:
    Jan 2010

    Posted 05 Jan 2011 Link to this post

    Thanks very much Nikolay, That worked perfectly for me.

    Cheers,
    Andrew.
  5. Michael
    Michael avatar
    4 posts
    Member since:
    Oct 2012

    Posted 14 Oct 2013 Link to this post

    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);
    }
Back to Top