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

Events

The Telerik UI Spreadsheet for ASP.NET Core exposes a number of JavaScript events that allow you to control the behavior of the UI component.

For a complete example of how to handle all Spreadsheet events triggered by user interaction, refer to the demo on using the events of the Spreadsheet .

Subscribing to Events

The following example demonstrates how to subscribe to the Changing and Change events.

    @(Html.Kendo().Spreadsheet()
        .Name("spreadsheet")
        .Events(events => events
            .Changing("onChanging")
            .Change("onChange")
        )
        .Sheets(sheets =>
        {
            sheets.Add()
                .Name("Sheet1")
                .Columns(columns =>
                {
                    columns.Add().Width(115);
                })
                .Rows(rows =>
                {
                    rows.Add().Height(25).Cells(cells =>
                    {
                        cells.Add()
                            .Value("ID")
                            .TextAlign(SpreadsheetTextAlign.Center);
                    });
                });
        })
    )

    <script>
        function onChanging(e) {
            // Handle the changing event.
        }

        function onChange(e) {
            // Handle the change event.
        }
    </script>
    <kendo-spreadsheet name="spreadsheet" on-changing="onChanging" on-change="onChange">
        <sheets>
            <sheet name="Sheet1">
                <columns>
                    <sheet-column width="115">
                    </sheet-column>
                </columns>
                <rows>
                    <sheet-row height="25">
                        <cells>
                            <cell value="ID" text-align="SpreadsheetTextAlign.Center">
                            </cell>
                        </cells>
                    </sheet-row>
                </rows>
            </sheet>
        </sheets>
    </kendo-spreadsheet>

    <script>
        function onChanging(e) {
            // Handle the changing event.
        }

        function onChange(e) {
            // Handle the change event.
        }
    </script>

Next Steps

See Also

In this article