We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to finish editing label on enter press

Thread ID:





143731 Apr 3,2019 04:11 AM UTC Apr 3,2019 06:29 AM UTC ASP.NET Web Forms (Classic) 1
Tags: DiagramWebControl
David van Laar Veth
Asked On April 3, 2019 04:11 AM UTC


When I am editing the label of a connector and press enter, I do not want the label to have a new line, but instead finish editing and apply the text entered (without a new line character) to the label.

Is there any way to do this?


Ramya Thirugnanam [Syncfusion]
Replied On April 3, 2019 06:29 AM UTC

Hi David,  
Please use diagram commandManager to achieve your requirement. While editing a label, when we press enter key, the command manager executes method(stopEdit) will be called and we have performed endEdit action in it. Please refer to the code example and help documentation.  
Code example:   
var Commands = new Dictionary<string, object>  
                new Command  
                    CanExecute = "canStopEdit",  
                  Execute = “stopEdit”,  
                    Gesture = new Gesture {Key = Keys.Enter }  
            DiagramContent.CommandManager.Commands = Commands;  
function canStopEdit() {  
     if (args.model.selectedItems.children.length > 0) {  
                                        return true;  
 function stopEdit() {  
        var diagram = $("#diagram").ejDiagram("instance");  
    //label editing stop once we press an enter key                                             diagram.model.commandManager.commands["endEdit"].execute(args);  
Ramya T  


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon