Updating ContentBlock pulled from pageManager.LoadControl()

Posted by Community Admin on 04-Aug-2018 11:17

Updating ContentBlock pulled from pageManager.LoadControl()

All Replies

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

Is there a way to save a modified ContentBlock that I extracted from the LoadControl method? Here's what I have so far, and it doesn't seem to work sadly.

var pageManager = PageManager.GetManager();
 
 foreach (var c in duplicated.Page.Controls)
 
     // go through the properties, use the ID to grab the right text
     foreach (var p in c.Properties)
     
         if (p.Name == "ID")
         
             var content = pageContent.Where(content_pair => content_pair.Key == p.Value).SingleOrDefault();
             var control = pageManager.LoadControl(c);
             if (control is ContentBlock)
             
                 ContentBlock contentBlock = (ContentBlock) control;
                 contentBlock.Html = content.Value;
             
         
     
 
 pageManager.SaveChanges();

This thread is closed