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

Forums / Developing with Sitefinity / WYSIWYG...multiple areas

WYSIWYG...multiple areas

2 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    03 Mar 2010
    Link to this post
    I've got s bunch of generic content containers on my page, but the base styles are slighly different based on the div those sit in on the page...is there a way to bring that in and style the EditorContentArea differently based on where the parent sits?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    03 Mar 2010
    Link to this post
    Hi Steve,

    You can style EditorContentArea in runtime. You need to loop through controls collection and check whether there is a control of type GenricContent. If you find it get its ContentPlaceHolder and style RadEditor's EditorContentArea.

    sample code

    1. Get reference to the ContentPlaceHolder and find the control from there

    ContentPlaceHolder holder = this.Page.Master.FindControl("Content") as ContentPlaceHolder;
     
           if (holder != null)
     
           {
     
               // get the controls from the holder and check whether there is
                    // a control of type GenericContent.
     
           }

    2. Get reference to the ICmsPage and find ICmsWebControl  from the controls collection

    sample ( this will get the current page)

    ICmsUrlContext pageKey = (ICmsUrlContext)this.Context.Items[Telerik.Cms.Web.UrlHelper.CmsPageKey];
     
         Guid currentPageID = pageKey.PageID;
     
         var cmsManager = new CmsManager();
     
         ICmsPage page = (ICmsPage)cmsManager.GetPage(currentPageID);
     
         if (page != null)
     
         {
                 foreach (ICmsWebControl cntrl in page.staged.Controls)
                 {
                    if (cntrl.ControlType == typeof(GenericContent))
                    {
                        Control c = cntrl.LoadControl(this.Page);      
     
                    }
            }
     
         }

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
2 posts, 0 answered