Finding pages that contain a generic content control in Sitefinity 4.x - General Discussions - General Discussions - Progress Community

Finding pages that contain a generic content control in Sitefinity 4.x

 General Discussions

Finding pages that contain a generic content control in Sitefinity 4.x

  • Finding pages that contain a generic content control in Sitefinity 4.x
  • I found this post explaining how to do this in Sitefinity 3.x:

    www.sitefinity.com/.../finding-pages-that-contain-a-generic-content-module.aspx

    Can anyone provide example code for Sitefinty 4.0 or point me in the right direction?

    Thanks - John
  • Anyone have any ideas?
  • Hi jdemar,

    Here is a sample code that will get all ContentBlock controls

    var manager = PageManager.GetManager();
    var controlType = typeof(ContentBlock).FullName;
     
      
    var controls = manager.GetControls<PageControl>().Where(pc => pc.ObjectType == controlType);
    foreach(var cb in controls)
       var page = cb.Page; // This is the PageData object on which the control resides.


    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items