Access RadDataPager from code-behind file

2 posts, 1 answers
  1. Bastien Léonard
    Bastien Léonard avatar
    3 posts
    Member since:
    Mar 2010

    Posted 01 Jun 2010 Link to this post


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

    <RadListView id="RadListView1" ...> 
            <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.
  2. Answer
    Rosen avatar
    3215 posts

    Posted 02 Jun 2010 Link to this post

    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,
    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.
  3. DevCraft R3 2016 release webinar banner
Back to Top