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

Access RadDataPager from code-behind file

1 Answer 82 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Bastien Léonard
Top achievements
Rank 1
Bastien Léonard asked on 01 Jun 2010, 02:36 PM
Hello,

I'm using RadDataPager inside a RadListView. It looks something like this:

<RadListView id="RadListView1" ...> 
    <LayoutTemplate> 
        <RadDataPager id="RadDataPager1" ...> 

Is it possible to access the RadDataPager from the code-behind file?
In particular, I want to change its Visible attribute at runtime.

I tried RadListView1.FindControl("RadDataPager1"), but it returns null.


Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 02 Jun 2010, 08:24 AM
Hi Bastien,

The most appropriate way to access the controls placed directly in the RadListView's LayoutTemplate is LayoutCreated server-side event. Similar to the following:

protected void RadListView1_LayoutCreated(object sender, EventArgs e)
{
    var datapager = ((RadListView)sender).FindControl("RadDataPager1") as RadDataPager;        
}


All the best,
Rosen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
ListView
Asked by
Bastien Léonard
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or