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

Customizing raddatapager pagesizetext

3 Answers 84 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Stein
Top achievements
Rank 1
Stein asked on 23 Apr 2020, 01:31 PM
Is it possible to set the PageSizeText through code when using the RadDataPager for a RadListView?

3 Answers, 1 is accepted

Sort by
0
Doncho
Telerik team
answered on 28 Apr 2020, 10:26 AM

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.
0
Stein
Top achievements
Rank 1
answered on 28 Apr 2020, 10:28 AM
I am not looking to change the PageSize, but the PageSizeText-property.
0
Doncho
Telerik team
answered on 28 Apr 2020, 10:46 AM

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.
Tags
ListView
Asked by
Stein
Top achievements
Rank 1
Answers by
Doncho
Telerik team
Stein
Top achievements
Rank 1
Share this question
or