New to Telerik UI for ASP.NET Core? Download free 30-day trial

Events

You can subscribe to all Diagram events and then use them to further customize the behavior of the Diagram.

For a complete example on Diagram events, refer to the demo on using the events of the Diagram.

Handling by Handler Name

The following example demonstrates how to subscribe to events by a handler name.

    @(Html.Kendo().Diagram()
        .Name("diagram")
        .Events(e => e
            .Add("onAdd")
        )
    )
    <script>
        // The Diagram instance is available as an e.sender or this.
        function onAdd(e) {
            // Handle the add event.
        }
    </script>
    <kendo-diagram name="diagram" on-add="onAdd"></kendo-diagram>
    <script>
        // The Diagram instance is available as an e.sender or this.
        function onAdd(e) {
            // Handle the add event.
        }
    </script>

Handling by Template Delegate

The following example demonstrates how to subscribe to events by a template delegate.

    @(Html.Kendo().Diagram()
        .Name("diagram")
        .Events(e => e
            .Add(@<text>
              function(e) {
                  //Handle the add event inline.
              }
            </text>)
        )
    )
    <kendo-diagram name="diagram" 
                   on-add="function(){
                      // Handle the add event.
                   }" 
    </kendo-diagram>

Next Steps

See Also

In this article