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

Custom Editor ToolBar

1 Answer 70 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Hiren
Top achievements
Rank 1
Hiren asked on 30 Oct 2011, 05:27 PM
I need a default toolbar that is provided by the edior. Along with all the optiuon i need to add one dropdown, the values will be comming from the database. Is there a way that i dont have to write the code for adding default toolbar & write the code only for adding a dropdown. I checked the example provided in

http://demos.telerik.com/aspnet-ajax/editor/examples/customdropdowns/defaultcs.aspx


This will not add default toolbar, Please suggest what shopuld be the approach.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 31 Oct 2011, 07:58 AM
Hi Hiren,

If you create and add dynamically the custom dropdown from the codebehind, you can load the default toolbar by firing the

protected void Page_Load(object sender, System.EventArgs e)
{
    RadEditor1.EnsureToolsFileLoaded();
    EditorToolGroup dynamicToolbar = new EditorToolGroup();
    RadEditor1.Tools.Add(dynamicToolbar);
 
    //add a custom dropdown and set its items and dimension attributes
    EditorDropDown ddn = new EditorDropDown("DynamicDropdown");
    ddn.Text = "Dynamic dropdown";
 
    //Set the popup width and height
    ddn.Attributes["width"] = "110px";
    ddn.Attributes["popupwidth"] = "240px";
    ddn.Attributes["popupheight"] = "100px";
 
    //Add items
    ddn.Items.Add("Daily signature", "TTYL,<br/>Tom");
    ddn.Items.Add("Informal Signature", "Greetings,<br/>Tom");
    ddn.Items.Add("Official Signature", "Yours truly,<br/>Tom Jones");
 
    //Add tool to toolbar
    dynamicToolbar.Tools.Add(ddn);
}

Another option is to download the default ToolsFile.xml file from the following KB article: Default ToolsFile.xml file of RadEditor for ASP.NET AJAX and register the custom dropdown declaration in it:

<tool name="Emoticons" Name="Emoticons"  type="dropdown" PopupWidth="170px" PopupHeight="117px">
  <item  name="<img src='icons/1.gif' />"  value="icons/1.gif"  />
  <item  name="<img src='icons/2.gif' />"  value="icons/2.gif"  />
  <item  name="<img src='icons/3.gif' />"  value="icons/3.gif"  />
  ...
</tool>


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
Hiren
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or