adding cstom dropdown to editor toolbar

3 posts, 0 answers
  1. Sarah
    Sarah avatar
    2 posts
    Member since:
    May 2011

    Posted 08 May 2011 Link to this post

    I want to add a dropdown for tokens to a radeditor.  However, when I do this

    <telerik:RadEditor runat="server" ID="BodyEditor" >
                        <Tools>
                            <telerik:EditorToolGroup>
                                 <telerik:EditorDropDown Name="Tokens" Text="Tokens">
                                 </telerik:EditorDropDown>
                            </telerik:EditorToolGroup>
                        </Tools>
                        <Content>
                        </Content>
                    </telerik:RadEditor>

    the formatting toolbar and others no longer appears.  I only want to add my custom dropdown, not replace the default toolbar.
  2. Sarah
    Sarah avatar
    2 posts
    Member since:
    May 2011

    Posted 09 May 2011 Link to this post

    anyone who could help?
  3. Rumen
    Admin
    Rumen avatar
    13804 posts

    Posted 10 May 2011 Link to this post

    Hello Sarah,

    When you set the tools collection the editor's toolbar is reset and you should manually declare all tools that you want to appear on the toolbar.

    If you do not like this behavior, you can

    1) add programmatically the custom dropdown via the codebehind, e.g.

    BodyEditor.EnsureToolsFileLoaded(); //execute this method to load the default tools set
    //add a new Toolbar dynamically   
    EditorToolGroup dynamicToolbar = new EditorToolGroup();
    BodyEditor.Tools.Add(dynamicToolbar);
     
    //add a custom dropdown and set its items and dimension attributes   
    EditorDropDown ddn = new EditorDropDown("Tokens");
    ddn.Text = "Tokens";
     
    //Add items   
    ddn.Items.Add("Tokens", "Tokens");
    ddn.Items.Add("Tokens", "Tokens");
    ddn.Items.Add("Tokens", "Tokens");
     
    //Add tool to toolbar   
    dynamicToolbar.Tools.Add(ddn);

    or via the toolsfile.xml file:

    <tool name="Tokens" type="dropdown">
        <item  name="Tokens"  value="Tokens"  />
        <item  name="Tokens"  value="Tokens"  />
        <item  name="Tokens"  value="Tokens"  />
    </tool>

    You can download the default toolsfile.xml file from the following KB article: Default ToolsFile.xml file of RadEditor for ASP.NET AJAX and add the above dropdown declaration to one of the tools tags.

    All the best,
    Rumen
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top