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

new to Telerik, seeking for sample

7 Answers 71 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jimmy
Top achievements
Rank 1
Iron
Veteran
Jimmy asked on 01 Feb 2019, 09:58 AM

Hi

 

I am new to Telerik, can someone point me to a sample of using Scheduler in Razor Page with EF data? I am not using Controller but code behind for Razor Page.

thanks in advance.

7 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 02 Feb 2019, 10:17 AM
Hello Jimmy,

From the point of view of the scheduler, the Razor page is no different than a regular view+controller - its CRUD operations need to point to the correct URLs where the controller will receive them. Those URLs are different in a Razor page than with a regular controller and that's all you need to take into account.

While we don't have a sample ready for the scheduler, we have two for the grid and the concept is the same:

On using EF - this is entirely up to the project and a sample that fits yours is highly specific. I would recommend you examine the arguments the handlers receive so you can see how they fit into your data access logic. The standard MVC Core demos we have also use a similar approach and you can download and inspect/run/modify them in Visual Studio if you like. For example, this one, where you can also see sample signatures of the CRUD operations methods: https://demos.telerik.com/aspnet-core/scheduler/index.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jimmy
Top achievements
Rank 1
Iron
Veteran
answered on 02 Feb 2019, 11:20 AM
Thanks Marin, will take a look at the link given.
0
Marin Bratanov
Telerik team
answered on 02 Feb 2019, 12:14 PM
Sure, Jimmy, take your own time and review how things work. If you have questions on the way our widgets work, let us know.

--Marin

0
Jimmy
Top achievements
Rank 1
Iron
Veteran
answered on 07 Feb 2019, 03:59 PM

Hi Marin

I have look into the sample but on the scheduler, I got 400 bad request when reading data.

My reading URL look's like this .Read(r => r.Url("?handler=Read")) which is valid because if I do a Ajax post, it does fired the OnPostRead method. but not when scheduler trying to read. Can you help on this? thanks

0
Jimmy
Top achievements
Rank 1
Iron
Veteran
answered on 07 Feb 2019, 04:14 PM

Hi Marin

More detail coding below

@(Html.Kendo().Scheduler<Caravel.Models.KenoSalesCalendarModel>()
                    .Name("scheduler")
                    .Date(DateTime.Today.AddDays(-(int)DateTime.Today.DayOfWeek + (int)DayOfWeek.Monday))
                    .StartTime(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 8, 00, 00))
                    .Height(600)
                    .Views(views =>
                    {
                        views.DayView();
                        views.WorkWeekView(workWeekView =>
                        {
                            workWeekView.Selected(true);
                        });
                        views.WeekView();
                        views.MonthView();
                        views.AgendaView();
                        views.TimelineView();
                    })
                    .Timezone("Asia/Singapore")
                    .Resources(resource =>
                    {
                        resource.Add(m => m.OwnerID)
                            .Title("Owner")
                            .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
                        .Events(e => e.Error("onError"))
                        .Model(m =>
                        {
                            m.Id(f => f.TaskID);
                            m.Field(f => f.Title).DefaultValue("No title");
                            m.Field(f => f.OwnerID).DefaultValue(1);
                            m.RecurrenceId(f => f.RecurrenceID);
                        })
                        .Read(r => r.Url("?handler=Read").Type(HttpVerbs.Post))
                        .Filter(filters =>
                        {
                            filters.Add(model => model.OwnerID).IsEqualTo(1).Or().IsEqualTo(2);
                        })
 
                    )
)     
0
Marin Bratanov
Telerik team
answered on 09 Feb 2019, 06:11 PM
Hello Jimmy,

I am attaching here a sample with razor pages I made for you that seems to work fine for me. Could you compare against it to see what's the difference causing the issue? If you still can't resolve it, please modify my sample to showcase the issue so I can have a better look at it.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jimmy
Top achievements
Rank 1
Iron
Veteran
answered on 11 Feb 2019, 01:42 AM
Thanks Marin for the sample.
Tags
Scheduler
Asked by
Jimmy
Top achievements
Rank 1
Iron
Veteran
Answers by
Marin Bratanov
Telerik team
Jimmy
Top achievements
Rank 1
Iron
Veteran
Share this question
or