This is a migrated thread and some comments may be shown as answers.

Creating a razor template for event creation

1 Answer 116 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
alex
Top achievements
Rank 1
alex asked on 02 Jan 2014, 05:29 PM
I have a requirement to override the existing window to add an event as we have additional field we would like to display. The Template open correctly and populates the standard scheduler columns. However before opening the window I need to call our server to get a list of event types and a list of member (or possible members). 

or index.cshtml looks like this

            @(Html.Kendo().Scheduler<TalkBox.Mvc.ViewModels.Calendar.CalendarViewModel>()
                  .Name("scheduler")
                  .Date(DateTime.UtcNow)
                  .Timezone("Etc/UTC")
                  .Height(700)
                  .BindTo(Model)
                  .Views(views =>
                            {
                                views.DayView(dayView => dayView.Selected(true));
                                views.WeekView();
                                views.MonthView();
                                views.AgendaView();
                            })
                   .DataSource(d => d
                        .Model(m => m.Id(f => f.EventId))
                        .Read(u => u.Action("Read", "Calendar"))
                        .Update(u => u.Action("Update", "Calendar").Data("serialize"))
                        .Create(c => c.Action("Create", "Calendar").Data("serialize"))
                        .Destroy(delete => delete.Action("Delete","Calendar"))
                    ) 
                    .Editable(e => e.TemplateName("CalendarEditor"))

I thought that the .Read(u => u.Action("Read", "Calendar")) would fire the read function before the template is displayed.

How do I fire an event on open of the new template?

Damion


1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 06 Jan 2014, 10:57 AM
Hello Damion,

I would suggest you check this code library, which shows how to define a custom editor. In general, the fields will be populated if the correct bindings are added (value binding points to a specific model property).

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Scheduler
Asked by
alex
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or