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

Forums / Developing with Sitefinity / RTE in custom user control

RTE in custom user control

8 posts, 1 answered
  1. David van Geel
    David van Geel avatar
    59 posts
    Registered:
    19 Aug 2009
    09 Mar 2010
    Link to this post
    Hi all,

    I have created a custom user control with a number of properties (title, subtitle, intro, link url and thumbnail). For this user control I created a ControlBase and Designer class so the customer can set the content in a simple way. This works and works fairly well but now I would like to change the Intro property from a (mulitline) text box to a rich text editor. I have found some threads about this (e.g. http://www.sitefinity.com/support/kb/sitefinity-3-x/implementing-rich-text-property-editor.aspx) and tried to implement them but that only made a "select" button appear behind the intro poperty on the advanced tab. So basically I am missing something in de designer of user control but I have no idea what. Any pointers?

    Regards,


    David
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    09 Mar 2010
    Link to this post
    Hi David van Geel,

    The problem is that the designer has higher z-index than the selector and some of the tools could be overplayed. You can observer the styles that are applied to the ControlDesigner and your RadEditor with FireBug and increase/decrease the z-index value. You can gather more information at - Z-index demystified .

    Greetings,
    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.
  3. David van Geel
    David van Geel avatar
    59 posts
    Registered:
    19 Aug 2009
    09 Mar 2010
    Link to this post
    Hi Ivan,

    What you talk about is happening but this is not my main question. Let me rephrase it. It's probably my English. With my additions I get a "select" button displayed after the intro property on the advanced tab of the user control. What I was looking for is a way to add a rich text editor to the designer page. So on the "basic" tab of the user control I would like to use a RTE for the intro property.

    Regards,


    David
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    09 Mar 2010
    Link to this post
    Hello David van Geel,

    So on the "basic" tab of the user control I would like to use a RTE for the intro property.


    You can take a look at Making Control Editing User-Friendly with Sitefinity Control Designers

    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.
  5. David van Geel
    David van Geel avatar
    59 posts
    Registered:
    19 Aug 2009
    09 Mar 2010
    Link to this post
    Hi Ivan,

    I looked at that page (amongst others) and I already have a Custom Control Designer active. What I would like to do now is use the rich text editor on that Custom Control Designer. So say that I would like to use a RTE for the "Text" property in the example Gabe mentioned. Is that possible?

    Regards,


    David
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    09 Mar 2010
    Link to this post
    Hi David van Geel,

    Below is a sample code

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Cms.Web.UI;
    using Telerik.Framework.Web.Design;
    using Telerik.Web.UI;
    using System.ComponentModel;
    using Telerik.Lists;
    using System.Web.UI.WebControls;
     
    /// <summary>
    /// Summary description for ControlWithCustomDesigner
    /// </summary>
    ///
    [ControlDesignerAttribute("ControlDesignerCustom, App_Code")]
    public class ControlWithCustomDesigner : SimpleControl
    {
     
        public ControlWithCustomDesigner()
        {
        }
     
        public string RadEditorContent
        {
            get
            {
                object obj = this.ViewState["RadEditorContent"];
                if (obj != null)
                    return (string)obj;
                return "Type Some Content here";
     
            }
            set
            {
                this.ViewState["RadEditorContent"] = value;
            }
        }
     
         
    }

    public class ControlDesignerCustom : Telerik.Framework.Web.Design.ControlDesigner
    {
        public ControlDesignerCustom()
        {
        }
     
     
        public override string LayoutTemplatePath
        {
            get
            {
                return templatePath;
            }
            set
            {
                base.LayoutTemplatePath = value;
            }
        }
     
        
     
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
     
             
            Editor.Content = ((ControlWithCustomDesigner)DesignedControl).RadEditorContent;
        }
     
        public override void OnSaving()
        {
        
            base.OnSaving();
     
            ((ControlWithCustomDesigner)DesignedControl).RadEditorContent =  Editor.Content;
     
          
        }
     
     
        protected virtual RadEditor Editor
        {
            get
            {
                return base.Container.GetControl<RadEditor>("textEditor", true);
            }
        }
     
     
        public RadComboBox combo
        {
            get
            {
                return base.Container.GetControl<RadComboBox>("RadComboBox1", true);
            }
        }
     
     
        private string templatePath = "~/SomeTemplate.ascx";

    in the designer template you should have RadEditor declaration

    <telerik:RadEditor
        runat="server"
        ID="textEditor"
        ContentAreaCssFile="~/Sitefinity/Admin/Themes/Default/AjaxControlsSkins/Sitefinity/EditorContentArea.css"
        ToolsFile="~/Sitefinity/Admin/ControlTemplates/EditorToolsFile.xml"   
        Skin="Black"   
        NewLineBr="False"
        Height="220px"
        Width="90%"
         
        ContentFilters="MakeUrlsAbsolute, EncodeScripts,FixUlBoldItalic,FixEnclosingP,IECleanAnchors,MozEmStrong,ConvertFontToSpan,ConvertToXhtml,IndentHTMLContent">
        <ImageManager ViewPaths="~/Images" UploadPaths="~/Images" DeletePaths="~/Images" />
        <MediaManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" />
        <FlashManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" MaxUploadFileSize="60000000" />
        <DocumentManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" />
        <TemplateManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files"  MaxUploadFileSize="300"/>
        <CssFiles>
            <telerik:EditorCssFile Value="~/Sitefinity/Admin/Themes/Default/AjaxControlsSkins/Sitefinity/EditorCssFile.css" />
        </CssFiles>
        <Tools>
        <telerik:EditorToolGroup>
        <telerik:EditorTool Name="ToggleScreenMode" />
         </telerik:EditorToolGroup>
         <telerik:EditorToolGroup>
        <telerik:EditorDropDown  Name="TEST" Text="TEST">
        <telerik:EditorDropDownItem Name="bla" Value="myclass"/>
        </telerik:EditorDropDown>
         
         </telerik:EditorToolGroup>
        </Tools>
    </telerik:RadEditor>


    All the best,
    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.
    Answered
  7. David van Geel
    David van Geel avatar
    59 posts
    Registered:
    19 Aug 2009
    09 Mar 2010
    Link to this post
    Hi Ivan,

    That looks like it! Thanks for the help and I'll give it a go tomorrow.

    Regards,


    David
  8. David van Geel
    David van Geel avatar
    59 posts
    Registered:
    19 Aug 2009
    10 Mar 2010
    Link to this post
    Hi Ivan,

    Just implemented your suggestion and it worked exactly like we wanted. Thanks for the service!

    Regards,


    David
Register for webinar
8 posts, 1 answered