RadEditor: How to add limited tools and Toolbar Mode

3 posts, 1 answers
  1. Mark
    Mark avatar
    25 posts
    Member since:
    Feb 2012

    Posted 30 Aug 2012 Link to this post

    Question:  I'm trying to add a RadEditor to my application - but it's a control generated on the fly in the back end.

    How can I add this control (and limited features) dynamically in the code behind?
    Basically, all I want to do is add the editor with the following:
    • Font Choices (limited to: "Arial", "Times New Roman", "Frutiger Roman")
    • Text Size (limited range from 8px - 25px)
    • Font Color Choices (limited to maybe 3 or more colors)
    • Font Bold
    • Font Italic
    • Font Underline
    • Cut/Copy/Paste

    Thanks in advance.

  2. Mark
    Mark avatar
    25 posts
    Member since:
    Feb 2012

    Posted 30 Aug 2012 Link to this post

    OK, I found what I was looking for - but still have a question. 
    First - this is how I got it to do what I wanted to do (since this control will be generated on the fly - it was important to create styling).

    My question is - how do I get the header (the control name) to NOT show up on the control?
    (attached image)

    var custpanel = new Panel();
    custpanel.ID = f.Field_Number;

    var topContainer = new Literal();
    topContainer.Text = "<div style='float:left; margin-left:90px;'><div stlyle='float:left;'>";
    var ctxtLabel = new Label();
    ctxtLabel.Text = f.Friendly_Name;
    var leftContainer = new Literal();
    leftContainer.Text = "</div><div style='float:left;'>";
    //create the editor
    var ctxt = new RadEditor();
    ctxt.ID = "Text" + f.Field_Number;
    //ctxt.MaxHtmlLength = 260;
    ctxt.Width = 410;
    ctxt.EditModes = EditModes.Design;
    ctxt.ToolbarMode = EditorToolbarMode.Default;
    ctxt.ToolsFile = "../TelerikResources/ToolsFile.xml";
    string[] font = { "Trebuchet MS", "Arial", "Times New Roman", "Frutiger Roman" };

    foreach (string fonts in font)
    var bottomContainer = new Literal();
    bottomContainer.Text = "</div><div style='clear:both;'></div></div>";

    tt.TargetControlID = ctxt.ID;

    if (cf.Value != f.Friendly_Name)
    ctxt.Text = cf.Value;
  3. Answer
    Rumen avatar
    14437 posts

    Posted 03 Sep 2012 Link to this post


    The text displayed over the RadEditor's toolbar is actually displayed by the ctxtLabel label control, but not by RadEditor. You should remove this line in your code to remove the message:

    ctxtLabel.Text = f.Friendly_Name;

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top