Customizing raddatapager pagesizetext

4 posts, 0 answers
  1. Stein
    Stein avatar
    27 posts
    Member since:
    Apr 2008

    Posted 23 Apr 2020 Link to this post

    Is it possible to set the PageSizeText through code when using the RadDataPager for a RadListView?
  2. Doncho
    Admin
    Doncho avatar
    95 posts

    Posted 28 Apr 2020 Link to this post

    Hello Stein,

    You can use the PageSize property of the RadDatPager to define the page size programmatically. You just need to reference the RadDataPager in the RadListView.

    If the RadDataPager is in a template you can try the approach discussed in the Accessing Controls article.

    Sample C# code

    (RadListView1.FindControl("RadDataPager1") as RadDataPager).PageSize = 5;

     

    I hope that will help.

    Kind regards,
    Doncho
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
  3. Stein
    Stein avatar
    27 posts
    Member since:
    Apr 2008

    Posted 28 Apr 2020 in reply to Doncho Link to this post

    I am not looking to change the PageSize, but the PageSizeText-property.
  4. Doncho
    Admin
    Doncho avatar
    95 posts

    Posted 28 Apr 2020 Link to this post

    Hi Stein,

    I apologize for my inaccurate answer.

    Once you have reference to the pager you should reach the PageSize Field and set the desired text by its PageSizeText property, see sample below:

    var pager = (RadListView1.FindControl("RadDataPager1") as RadDataPager);
    foreach (var field in pager.Fields)
    {
        if (field is RadDataPagerPageSizeField)
        {
            (field as RadDataPagerPageSizeField).PageSizeText = "custom Text";
        }
    }

    Kind regards,
    Doncho
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
Back to Top