Passing Client Data via AddText Command

2 posts, 0 answers
  1. Adrian
    Adrian avatar
    7 posts
    Member since:
    Jul 2012

    Posted 01 Aug 2012 Link to this post

    Hello,
    I have some custom commands that are working fine, and I am able to pass client data to the code-behind using the commandArgument. However, if I try to do the same thing for the built in AddText functionality, the popup dialog never displays.

    //Javascript
    //If this is done, the text editor dialog won't show. Not sure why.
    Telerik.Web.UI.ImageEditor.CommandList.AddText = function (imageEditor, commandName, args) {
        var commandText = "AddText";
        var commandArgument = customClientSideDataHere;
        imageEditor.editImageOnServer(commandName, commandText, commandArgument, callbackFunction);
    };

    I am currently reading the custom data here:
    protected void RadImageEditor1_ImageEditing(object sender, ImageEditorEditingEventArgs args)
    {
     string text = args.Argument;
    }

    If I comment out the client-side code above, the Add Text popup works as expected. Is there something I am doing wrong, or is there another way to pass client side data to the code-behind?
    Thanks,
    Adrian
  2. Vessy
    Admin
    Vessy avatar
    1380 posts

    Posted 06 Aug 2012 Link to this post

    Hi Adrian,

    The issue with the non displaying AddText's dialog is due to that the code bellow is actually overwriting all the functions of AddText command. This approach is useful when you need to declare a custom command and its functionality. If you want to customize some of the RadImageEditor's built-in commands (as it is in the case when you want to extend AddText's functions), the best way is to modify the RadImageEditor's dialog for this command.

    You could find more information about the mentioned approach in this help article: Loading the Dialogs from External Files and in this code library: Registering External Dialogs of RadImageEditor.

    All the best,
    Veselina
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top