Custom Editor ToolBar

2 posts, 0 answers
  1. Hiren
    Hiren avatar
    62 posts
    Member since:
    Dec 2010

    Posted 30 Oct 2011 Link to this post

    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.
  2. Rumen
    Admin
    Rumen avatar
    14366 posts

    Posted 31 Oct 2011 Link to this post

    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
Back to Top