Error in databind in Read operation

2 posts, 0 answers
  1. jaswanth
    jaswanth avatar
    2 posts
    Member since:
    Mar 2014

    Posted 31 Mar 2014 Link to this post

    Hi, From one of the example in kendo documentation, when i am trying the same i am unable to bind the data to the scheduler ui, it shows no error but only 500 internal server error. here is my code, I am using mvc 3 razor with EF.

    public class Projection : ISchedulerEvent
        {
            public string Title { get; set; }
            public DateTime Start { get; set; }
            public DateTime End { get; set; }
            public string Description { get; set; }
            public bool IsAllDay { get; set; }
            public string Recurrence { get; set; }
            public string RecurrenceRule { get; set; }
            public string RecurrenceException { get; set; }

            public string EndTimezone { get; set; }
            public string StartTimezone { get; set; }
        }

    [HttpGet]
            public ActionResult Read()
            {
                List<Projection> cinemaSchedule = new List<Projection> {
                    new Projection {
                        Title = "Fast and furious 6",
                        Start = new DateTime(2014,3,31,17,00,00),
                        End= new DateTime(2014,3,31,18,30,00)
                    },
                    new Projection {
                        Title= "The Internship",
                        Start= new DateTime(2014,3,31,14,00,00),
                        End= new DateTime(2014,3,31,15,30,00)
                    },
                    new Projection {
                        Title = "The Perks of Being a Wallflower",
                        Start =  new DateTime(2014,3,31,16,00,00),
                        End =  new DateTime(2014,3,31,17,30,00)
                    }};
                return Json(cinemaSchedule, JsonRequestBehavior.AllowGet);
            }

    @(Html.Kendo().Scheduler<Uco.Models.Projection>()
        .Name("scheduler")
        .Date(new DateTime(2014, 3, 31))
        .StartTime(new DateTime(2014, 3, 31, 7, 00, 00))
        .Height(600)
        .Views(views =>
        {
            views.DayView();
            views.WeekView(weekView => weekView.Selected(true));
            views.MonthView();
        })
        .Timezone("Etc/UTC")
        .BindTo(Model)
    )

    Can any one help with where i am wrong. I am new to telerik. Thanks in advance




  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 02 Apr 2014 Link to this post

    Hello jaswanth,

    The code snippet shows that the Read method is designed to return a JSON result (required for a remote binding), but the Scheduler is bound locally using BindTo method. You need to decide whether to use 
    local or remote binding. The first one requires from you to pass all events you want to show to the BindTo method. The other one is to use Action Read method and setup the CRUD using the DataSource fluent method. I would suggest you examine the offline demos part of the Telerik UI for ASP.NET MVC bundle.
    If the server error is still thrown I will ask you to provide more information about it.

    Regards,
    Georgi Krustev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top