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.