Finding pages that contain a generic content control in Site

Posted by Community Admin on 03-Aug-2018 23:11

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

All Replies

Posted by Community Admin on 13-May-2011 00:00

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

Posted by Community Admin on 17-May-2011 00:00

Anyone have any ideas?

Posted by Community Admin on 18-May-2011 00:00

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

This thread is closed