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

Custom dropdown button

6 Answers 216 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Rowen
Top achievements
Rank 1
Rowen asked on 15 Aug 2008, 12:40 AM
I have been searching for help on creating a custom dropdown/split button in RadEditor for asp.net ajax, to behave similarly to the undo/redo buttons or the insert table button for example.

Is this possible? If so, how would I get started?

Thanks,

Rowen

6 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 15 Aug 2008, 08:00 AM
Hi Rowen,

Please, review the following articles:
How to create a ToolStrip
and
Adding Custom Dropdowns.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Rowen
Top achievements
Rank 1
answered on 18 Aug 2008, 01:37 AM
Thanks, but neither of these examples are quite what I am looking for. I want a custom dropdown, but instead of having a select box style item in the toolbar with text and a dropdown arrow, I want a split button style icon to drop down the list. Onclick should execute the same tool with different parameters (similar to how InsertCodeSnippet functions I am guessing??).

Is it possible to get a dropdown tool to render with an icon instead of text?

The toolstrip can do this, but I don't think it will work for me easily because I am building the drop down list dynamically. Toolstrip appears to require a separate tool to be registered for each item. If I can use multiple copies of a single custom tool, can I register parameters that can be accessed when the tool is executing?

I thought there might be a straightforward way to do this but have not discovered any yet.

Regards,

Rowen

0
Rumen
Telerik team
answered on 18 Aug 2008, 11:45 AM
Hi Rowen,

At present, RadEditor for ASP.NET AJAX offers only the demonstrated custom dropdowns in the Adding Custom Dropdowns and How to create a ToolStrip examples.

The control does not offer currently support for hiding the dropdown header title and replacing it with an icon. This feature is logged in our To-Do list, but I cannot provide an exact estimate when it will be implemented.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Rowen
Top achievements
Rank 1
answered on 19 Aug 2008, 01:33 AM
Thanks for the information.

In that case, is there a way to add a custom tool to an editor toolstrip? I tried doing it through the toolsfile.xml:

    <EditorToolStrip Name="Link Options" popupheight="145px">
      <tool name="MyLinkManager" />
      <tool name="LinkManager" />
    </EditorToolStrip>

resulted in teh error :
Cannot find a string resource with key 'MyLinkManager' in App_GlobalResources/RadEditor.Tools.resx. Please, make sure that your custom localization has all needed resource strings, or copy the original localization resources from your installation folder to App_GlobalResources.

I can do it programmatically, but the custom tool  icon will not render in the drop down list (set through css in the same way I do for other custom tools which works... just not on toolstrip).

This appears to be 2 separate bugs related to the toolstrip?

Thanks for your help,

Rowen
0
Accepted
Rumen
Telerik team
answered on 19 Aug 2008, 02:33 PM
Hi Rowen,

Straight to the points:
  1. To fix the "Cannot find a string resource with key 'MyLinkManager' in App_GlobalResources/RadEditor.Tools.resx" error open the \App_GlobalResources\RadEditor.Tools.resx (you can import it from the installation folder) and create a new row with name MyLinkManager and the desired value for the MyLinkManager command.
  2. To render icons for the toolstrip and the custom item in it, rename the toolstrip name to LinkOptions in the ToolsFile:

    <tools ...>
        <EditorToolStrip Name="LinkOptions" popupheight="145px">
          <tool name="MyLinkManager" />
          <tool name="LinkManager" />
        </EditorToolStrip>
    ...

    and put the folling classes in the page with the editor:

    <style>
    .rade_toolbar.Default .LinkOptions
    {
       background-image: url(http://www.telerik.com/DEMOS/ASPNET/RadControls/Editor/Skins/Default/buttons/Custom.gif) !important;
    }
    .rade_toolbar.Default .MyLinkManager
    {
       background-image: url(http://www.telerik.com/DEMOS/ASPNET/RadControls/Editor/Skins/Default/buttons/Custom.gif) !important;
    }
    </style>

    If you experience problems with skin different from the default one, just let me know.
For your convenience I have attached a sample working project.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Rowen
Top achievements
Rank 1
answered on 19 Aug 2008, 11:19 PM
Excellent, that worked for me.

Thanks Rumen, very good support
Tags
Editor
Asked by
Rowen
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Rowen
Top achievements
Rank 1
Share this question
or