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

Custom Button

2 Answers 86 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Antoine
Top achievements
Rank 1
Antoine asked on 14 Oct 2007, 08:45 PM
Hi All,

I would like a button that inserts an Iframe with a predefined link. The reason I would like that is so that in Wiki, I can insert a menu on top of every wiki. When a user create a new page, all he would have to do is press the button to insert the menu (iframe)?
 
Any Idea?

Antoine

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 15 Oct 2007, 01:22 PM
Hi Antoine,

To add a custom toolbar button to RadEditor in a Wiki scenario, open the file and put the following red marked tag:

<root>
  <tools name="EnhancedToolbar" dockable="false" enabled="true">
    <tool name="Custom1" iconurl="<a path to an image file>" />
...

Save the file. This will render a button on the toolbar. After that open the Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES\RadEditorList.ascx file and put the red market JAVASCRIPT code in it:

<SharePoint:RenderingTemplate ID="RichTextField" runat="server">
    <Template>
        <telerik:RadHtmlListField id="RadTextField" runat="server" />
        <script type="text/javascript">
        RadEditorCommandList["Custom1"] = function(commandName, editor, oTool)
        {     
              // Execute your code here, provide it with any arguments that you need, etc.  
              editor.PasteHtml("test");
        };
        </script>

  ....
    </Template>
</SharePoint:RenderingTemplate>

This code will attach a function to the custom button, which will be executed when the user click on the button. In our scenario, the PasteHtml function will insert the sting test in the content area.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Antoine
Top achievements
Rank 1
answered on 15 Oct 2007, 03:25 PM
Thank you very much for the quick answer. I will give it a go.

Have a nice day,

Antoine
Tags
WebParts for SharePoint
Asked by
Antoine
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Antoine
Top achievements
Rank 1
Share this question
or