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

Forums / 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

3 posts, 0 answered
  1. jdemar
    jdemar avatar
    2 posts
    Registered:
    08 Jun 2007
    13 May 2011
    Link to this post
    I found this post explaining how to do this in Sitefinity 3.x:

    http://www.sitefinity.com/devnet/forums/sitefinity-3-x/developing-with-sitefinity/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
  2. jdemar
    jdemar avatar
    2 posts
    Registered:
    08 Jun 2007
    17 May 2011
    Link to this post
    Anyone have any ideas?
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    18 May 2011
    Link to this post
    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
3 posts, 0 answered