How can I have a custom toolbar button execute server-side code?

2 posts, 0 answers
  1. Ross Presser
    Ross Presser avatar
    30 posts
    Member since:
    Dec 2008

    Posted 18 Jun 2014 Link to this post

    When the user clicks this button on the toolbar, I want to trigger some server side code which will convert from "HTML scripting" to "VB scripting" in our system.  (Neither of those things is exactly what you think it is. ) I have created the toolbar button:
        Private Sub formatFieldScriptingHtml(ByRef re As RadEditor, ByVal textdir As eDocLibrary.eDocFieldInfo.textDirection)
            re.ToolsFile = "~/include/FieldScriptingToolsFile.xml"
            re.ContentFilters = EditorFilters.None
            'This button needs to be added in codebehind, because it gets localized button text
            'The other buttons are standard toolbar buttons that get localized by Telerik
            Dim toVB = New Telerik.Web.UI.EditorTool
            toVB.Name = "toVB"
            toVB.Text = Resources.Main.ConvertToVbButtonText '"Convert to VB", localized
            toVB.ShowIcon = False
            toVB.ShowText = True
    ' ... omitted code
    End Sub

    And I've put this in a RadScriptBlock, though I'm not sure it's working:
            Telerik.Web.UI.Editor.CommandList["toVB"] = function (commandName, editor, args) {
                var ajaxManager = $find("<%= AjaxManager.ClientID%>");

    Will this look for a server side function called "toVB"? Or what exactly do I have to do?
  2. Ianko
    Ianko avatar
    1507 posts

    Posted 19 Jun 2014 Link to this post

    Hello Ross,

    Using the RadAjaxManager to invoke a code behind logic should be further implemented by attaching a server-side OnAjaxRequest event handler and handle the passed arguments in the implemented VB method.

    You can find a proper example in this help article by following Example 1 and 2.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
Back to Top