How can I get the page that contains a specific control? - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

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

  • How can I get the page that contains a specific control?
  • I want to get a list of pages that contains a specific control. How can this be done?
  • 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
  • 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