contentblock

Posted by Community Admin on 04-Aug-2018 15:15

contentblock

All Replies

Posted by Community Admin on 15-Feb-2012 00:00

Hi,

I have the following code, that I am using to find contenblocks in a page. But I am not sure how to get the content from the contentblock.

 PageManager pageManager = PageManager.GetManager();
 IQueryable<PageData> pages = pageManager.GetPageDataList();
 foreach (PageData page in pages)
  
            foreach (var c in page.Controls)
           
                var ctrl = pageManager.LoadControl(c);
                if (ctrl is ContentBlock)
               
                    //get content
               
           
      

Thanks,
Annie

Posted by Community Admin on 16-Feb-2012 00:00

Hello Annie,

The ContentBlock control has a property Html that you can operate with directly or use:

var htmlProperty = item.GetProperties(culture, false).SingleOrDefault(p => p.Name == "Html";


All the best,
Boyan Barnev
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