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

Adding a standard button programmatically

3 Answers 96 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Roger Withnell
Top achievements
Rank 1
Roger Withnell asked on 17 Jun 2010, 02:33 PM
I would like to add an InsertFormElement button programmatically.

I have used the following code from http://www.telerik.com/help/aspnet-ajax/addingstandardbuttons.html

Imports Telerik.Web.UI
...
Dim tool As New EditorTool("InsertFormElement")
tool.Type = EditorToolType.Button
RadEditor1.Tools(0).Tools.Add(tool)

tool does not appear to have a Type.  I tried omitting the line:

tool.Type = EditorToolType.Button

and the code still appears to work.  Why is this?

Secondly, RadEditor1.Tools(x).Tools.Add(tool) places the button at the end of tool group x.

Is it possible to position the button in a specific place within the group?

Your help would be much appreciated.

Thanking you in anticipation.

Roger

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 18 Jun 2010, 01:00 PM
Hi Roger,

Have you set the "Imports Telerik.Web.UI" line in the codebehind file?

For your convenience I have attached a sample working project in which the editor has enabled InsertFormElement from the codebehind and it is positioned at a specific place in the toolbar.

Greetings,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Roger Withnell
Top achievements
Rank 1
answered on 29 Jun 2010, 11:02 AM
Many thanks, Rumen, just the ticket.

On a related point, I also would like to programmatically remove a standard button.  Two things:

1)  How do I test if the button is present (I know where it in the toolbar)?
2) If it is present, how do I remove it?

Many thanks.

Roger
0
Rumen
Telerik team
answered on 01 Jul 2010, 02:55 PM
Hi Roger,

You can use the FindTool method to search for your button.
You can use the solution provided in this help article to remove the button: Removing Toolbar Buttons.

Best regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Editor
Asked by
Roger Withnell
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Roger Withnell
Top achievements
Rank 1
Share this question
or