This is a migrated thread and some comments may be shown as answers.

RadEditor: How to add limited tools and Toolbar Mode

2 Answers 91 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 30 Aug 2012, 06:29 PM
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 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 30 Aug 2012, 08:57 PM
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)

         pnlcontent.Controls.Add(lbl);
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)
{
ctxt.FontNames.Add(fonts);
}
 
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;
}
custpanel.Controls.Add(topContainer);
custpanel.Controls.Add(ctxtLabel);
custpanel.Controls.Add(leftContainer);
custpanel.Controls.Add(ctxt);
custpanel.Controls.Add(bottomContainer);
0
Accepted
Rumen
Telerik team
answered on 03 Sep 2012, 03:50 PM
Hello,

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;

Greetings,
Rumen
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.
Tags
Editor
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or