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

Add Custom Dropdown Within Default Toolbar

6 Answers 178 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Virgil Rodriguez
Top achievements
Rank 1
Virgil Rodriguez asked on 08 Mar 2012, 11:42 PM
Hi Telerik,

I have read a 2008 thread somewhere in which Rumen has said that it was not possible at that time to combine a custom dropdown within the default toolbar of RadEditor or any other custom toolbar for that matter.

Is this still the case at present - March 2012 ?

If it still is, are there any plans to change this?

It would really be helpful that you can combine, because it somewhat defeats the purpose of customizability.

Do  you have any suggested workarounds?

Thanks!

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Mar 2012, 10:21 AM
Hello,

Take a look into the following help documentation.
Adding Custom Dropdowns.

Thanks,
Princy.
0
Virgil Rodriguez
Top achievements
Rank 1
answered on 09 Mar 2012, 04:18 PM
Hi Princy,

Thanks for your reply and for providing that link "Adding Custom Dropdowns".

I am already familiar with that documentation and although it tells you how to add custom dropdown lists, it does NOT actually "add" a custom dropdown.
 
What it does is, it "replaces" whatever toolbar you have currently set, with the dropdown list that you are adding.

Can the default toolbar be retained while a custom dropdown list is also added?

Thanks.
0
Rumen
Telerik team
answered on 09 Mar 2012, 04:28 PM
Hello,

My suggestion is to implement a RadEditor's custom dropdown as shown in the following live demo: Custom Dropdowns. All other ways are hacks and requires JavaScript DOM coding.

Kind regards,
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.
0
Virgil Rodriguez
Top achievements
Rank 1
answered on 09 Mar 2012, 07:10 PM
Hi Rumen,

That "Custom Dropdowns" link doesn't help at all. It still doesn't show me how to combine the default toolbar (or any existing toolbar) with my own custom dropdown list. Why is this the case? This was the issue back in 2008, how come Telerik still does not allow this functionality?

Actually, the much better link is this: http://demos.telerik.com/aspnet-ajax/editor/examples/serversideapi/defaultvb.aspx. That demo actually shows the dynamic adding of toolbars and tools within a toolbar. This is what I'm trying to achieve but with no success.

You see, I have an .ASPX page that has an embedded .ASCX user control. Within the user control is a RadEditor.

Without adding my custom dropdown list, the sequence of events is this:
  • When Page_Load event fires: RadEditor1.Tools.Count = 0
  • When Page_Unload event fires: RadEditor1.Tools.Count = 7
  • When the user control is rendered, RadEditor1 shows all the tools of the default toolbar.

When I add my custom dropdownlist at the PAGE_LOAD event, the sequence of events is this:
  • When Page_Load event fires: RadEditor1.Tools.Count = 0
  • I then add my custom dropdownlist: RadEditor1.Tools.Count = 1
  • When Page_Unload event fires: RadEditor1.Tools.Count = 1
  • When the user control is rendered, RadEditor1 ONLY shows my dropdown list, all the tools of the default toolbar are GONE!

When I add my custom dropdownlist at the PAGE_UNLOAD event, the sequence of events is this:
  • When Page_Load event fires: RadEditor1.Tools.Count = 0
  • When Page_Unload event fires: RadEditor1.Tools.Count = 7
  • I then add my custom dropdownlist: RadEditor1.Tools.Count = 8
  • When the user control is rendered, RadEditor1 shows all the tools of the default toolbar, but my custom dropdown list was not added.

I think the ROOT of the problem is that the user control doesn't have a Page_LoadComplete event where RadEditor1.Tools.Count would be equal to 7 and where it could be the best place to add my custom dropdown list.

I'm not so sure if this still the case if my RadEditor was in an .ASPX page instead.

Do you know of a better place to add my custom dropdown list?

Many thanks!
0
Accepted
Rumen
Telerik team
answered on 14 Mar 2012, 12:00 PM
Hi,

When adding a new tool to the toolbar from the codebehind, the Tools collection is reset and only the new tool is displayed.
If you want to remain the default tools, you should execute the EnsureToolsFileLoaded() editor's method, e.g.

protected void Page_Load(Object sender, EventArgs args)
{
    RadEditor1.EnsureToolsFileLoaded();
     
    //add a new Toolbar dynamically   
    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);
}


Kind regards,
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.
0
Virgil Rodriguez
Top achievements
Rank 1
answered on 16 Mar 2012, 07:56 PM
Thanks a lot Rumen.

That is EXACTLY what I was looking for !!!
Tags
Editor
Asked by
Virgil Rodriguez
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Virgil Rodriguez
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or