+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / How can I get the page that contains a specific control?

How can I get the page that contains a specific control?

3 posts, 1 answered
  1. Bruno Michels
    Bruno Michels avatar
    125 posts
    Registered:
    16 Apr 2010
    17 Mar 2011
    Link to this post
    I want to get a list of pages that contains a specific control. How can this be done?
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    17 Mar 2011
    Link to this post
    Hi Bruno Michels,

    You can find an example for this in the news rotator sample control in the Sitefinity SDK.

    Best wishes,
    Radoslav Georgiev
    the Telerik team
    Answered
  3. Bruno Michels
    Bruno Michels avatar
    125 posts
    Registered:
    16 Apr 2010
    01 Apr 2011
    Link to this post
    var pageNodes = App.WorkWith().Pages().LocatedIn(PageLocation.Frontend)
        .Where(p => p.Page != null &&
            p.Page.Controls.Where(c => c.ObjectType.StartsWith(typeof(CONTROLTYPE).FullName)).Count() > 0)
        .Get()
        .ToList();

    Gets a list of pages with the specific control
3 posts, 1 answered