We are trying to use the @(Html.Kendo().Scheduler<myModel>() in Asp.net.
When I use Server Binding, and when my calendar page first displays, the tasks display in the calendar as expected.
Here is my Invoke method:
public async Task<IViewComponentResult> InvokeAsync()
List<myModel> myTasks = GetTasksfortheMonth();
return View(myTasks); //These display on calendar as expected
But when I switch months, I want to call the Read() method again to get that months data.
So I switched to using AJAX Binding.
Now when my calendar first displays or whenever I change months, my controller methods is called(below). But the tasks don't display in the calendar.
How do I get my tasks to display in the calendar when using AJAX binding?
My .cshtml
@Html.Kendo().Scheduler<myModel>()
....
.EventTemplate(
"<div class='movie-template'>" +
"<p>" +
"<h3> Title: #= title #</h3>" +
"</p>" +
"</div>")
.DataSource(d => d
.Model(m =>
{
m.Field(f => f.Title).DefaultValue("No title");
m.Field(f => f.Description).DefaultValue("no desc");
})
.Read("Read", "MyController") //this calls my controller method but no tasks appear in calendar
)
//.BindTo(Model) //Works for Server Binding, tasks appear in calendar when page renders first time
My Controller method:
public virtual JsonResult Read([DataSourceRequest] DataSourceRequest request)
{
List<myModel> myTasks = GetTasksfortheMonth();
return Json(myTasks.ToDataSourceResult(request));
}
When I use Server Binding, and when my calendar page first displays, the tasks display in the calendar as expected.
Here is my Invoke method:
public async Task<IViewComponentResult> InvokeAsync()
List<myModel> myTasks = GetTasksfortheMonth();
return View(myTasks); //These display on calendar as expected
But when I switch months, I want to call the Read() method again to get that months data.
So I switched to using AJAX Binding.
Now when my calendar first displays or whenever I change months, my controller methods is called(below). But the tasks don't display in the calendar.
How do I get my tasks to display in the calendar when using AJAX binding?
My .cshtml
@Html.Kendo().Scheduler<myModel>()
....
.EventTemplate(
"<div class='movie-template'>" +
"<p>" +
"<h3> Title: #= title #</h3>" +
"</p>" +
"</div>")
.DataSource(d => d
.Model(m =>
{
m.Field(f => f.Title).DefaultValue("No title");
m.Field(f => f.Description).DefaultValue("no desc");
})
.Read("Read", "MyController") //this calls my controller method but no tasks appear in calendar
)
//.BindTo(Model) //Works for Server Binding, tasks appear in calendar when page renders first time
My Controller method:
public virtual JsonResult Read([DataSourceRequest] DataSourceRequest request)
{
List<myModel> myTasks = GetTasksfortheMonth();
return Json(myTasks.ToDataSourceResult(request));
}