New to Telerik UI for ASP.NET CoreStart a free 30-day trial

Events

The Telerik UI Scheduler for ASP.NET Core exposes multiple events like Add, Edit, Resize, and more, that allows you to control the behavior of the UI component.

For a complete example of how to handle all Scheduler events triggered by user interaction, refer to the demo on using the events of the Scheduler . For a runnable example on the Move and Resize events, refer to the demo on handling the specific events.

Handling by Handler Name

The following example demonstrates how to subscribe to the DataBound and DataBinding events by a handler name.

Razor
    @(Html.Kendo().Scheduler<TaskViewModel>()
        .Name("scheduler")
        .Events(e => 
        {
            e.DataBinding("scheduler_dataBinding");
            e.DataBound("scheduler_dataBound");
        })
        // Additional configuration.
    )

Handling by Template Delegate

The following example demonstrates how to subscribe to the DataBound and DataBinding events by a template delegate.

Razor
    @(Html.Kendo().Scheduler<TaskViewModel>()
        .Name("scheduler")
        .Events(e => e
            .DataBinding(@<text>
                function() {
                    // Handle the DataBinding event inline.
                }
            </text>)
            .DataBound(@<text>
                function() {
                    // Handle the DataBound event inline.
                }
            </text>)
        )
        // Additional configuration.
    )

Applying Resource Restrictions

By handling the client-side events of the Scheduler, you can restrict the creation of events when resources are not available.

Razor
    @(Html.Kendo().Scheduler<TaskViewModel>()
        .Name("scheduler")
        .Resources(resource =>
        {
            resource.Add(m => m.RoomID)
                .Title("Room")
                .DataTextField("Text")
                .DataValueField("Value")
                .DataColorField("Color")
                .BindTo(new[] {
                        new { Text = "Meeting Room 101", Value = 1, Color = "#6eb3fa" },
                        new { Text = "Meeting Room 201", Value = 2, Color = "#f58a8a" }
                });
            resource.Add(m => m.Attendees)
                .Title("Attendees")
                .Multiple(true)
                .DataTextField("Text")
                .DataValueField("Value")
                .DataColorField("Color")
                .BindTo(new[] {
                        new { Text = "Alex", Value = 1, Color = "#f8a398" },
                        new { Text = "Bob", Value = 2, Color = "#51a0ed" },
                        new { Text = "Charlie", Value = 3, Color = "#56ca85" }
                });
        })
        .DataSource(d => d
            .Model(m =>
            {
                m.Id(f => f.MeetingID);
                m.Field(f => f.Title).DefaultValue("No title");
                m.RecurrenceId(f => f.RecurrenceID);
            })
            .Read("Meetings_Read", "Scheduler")
            .Create("Meetings_Create", "Scheduler")
            .Destroy("Meetings_Destroy", "Scheduler")
            .Update("Meetings_Update", "Scheduler")
        )
        .Events(e => e.Add("onAdd"))
        // Additional configuration.
    )

Next Steps

See Also