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

Background text on a day cell in scheduler

5 Answers 155 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Chandrasekhar
Top achievements
Rank 2
Chandrasekhar asked on 01 Jul 2014, 02:39 AM
Hi there,

I am using the MVC scheduler month view for my project. I wanted to change the color of a day cell if it was a public holiday and am achieving this by using the Slots.each method in Scheduler databound event.

I also need to add a description on the day cell if it is a public holiday, How can i achieve this?

Is there a property that i can access in the slots.each method to set the description or title for the day cell.

Please help.

Cheers,

Chandra

5 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 03 Jul 2014, 06:04 AM
Hi,


You can use the "dayTemplate" option of the Scheduler to set the template for the slots in month view:

Regards,
Vladimir Iliev
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.

 
0
Chandrasekhar
Top achievements
Rank 2
answered on 06 Jul 2014, 11:04 PM
Hi Vladimir,

Thanks for your reply.

Is there a simple example using the dayTemplate option using MVC razor?

Thanking you,

Chandra
0
Vladimir Iliev
Telerik team
answered on 07 Jul 2014, 08:30 AM
Hi,

Please check the example below of using the "DayTemplate" option of the "Month" view:

@(Html.Kendo().Scheduler<Kendo.Mvc.Examples.Models.Scheduler.TaskViewModel>()
    .Name("scheduler")
    .Date(new DateTime(2013, 6, 13))
    .StartTime(new DateTime(2013, 6, 13, 7, 00, 00))
    .Height(600)
    .Views(views =>
    {
        //make the dates link that will navigate to another view
        views.MonthView(m => m.DayTemplate("<a href='/Home/CustomView'><strong>#=kendo.toString(date,'dd')#</strong></a>"));

Regards,
Vladimir Iliev
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.

 
0
Chandrasekhar
Top achievements
Rank 2
answered on 07 Jul 2014, 11:45 PM
Hi Vladimir,

Thanks for your reply.

I am using custom event template already and now am using a custom day template as well. This is how i have initialized the scheduler.

@(Html.Kendo().Scheduler<Leap.StaffBudgets.Models.StaffBudget>()
                    .Name("scheduler")
                    .Date(DateTime.Today)                                       
                    .Width(855)
                    .Timezone("Etc/UTC")
                    .Messages(msg =>
                    {
                        msg.Editor(e => e.EditorTitle("Budget"));
                    })                    
                    .Views(views =>
                    {
                        views.MonthView(v => v.EventTemplateId("eventTemplate").EventHeight(60).Selected(true));
                        views.MonthView(v => v.DayTemplateId("dayTemplate"));
                    })
)
This is how my custom templates look,

<script id="eventTemplate" type="text/x-kendo-tmpl">
    <div style="border-style:none">
        </br>
        Hours: #=Hours#</br>
        Amount: #=Amount#</br>
    </div>
</script>

<script id="dayTemplate" type="text/x-kendo-tmpl">
    <div style="border-style:none;">
        #= kendo.toString(date, 'dd') #</br>         
        <label id="lblDayTitle" class="exclusionTitle"></label>        
    </div>
</script>
Now when i run my program and I am getting JavaScript runtime error: Unable to get property 'replace' of undefined or null reference.
Can you see any obvious problems that could cause this to happen?

Please help.

Thanks,
Chandra





0
Vladimir Iliev
Telerik team
answered on 08 Jul 2014, 08:53 AM
Hi,

I tried to reproduce the problem using the provided templates locally but to no avail – everything is working as expected on our side (the templates are valid). Could you please open a new support thread for the Scheduler and provide runable project where the issue is reproduced? This would help us pinpoint the exact reason for this behavior.

Regards,
Vladimir Iliev
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.

 
Tags
Scheduler
Asked by
Chandrasekhar
Top achievements
Rank 2
Answers by
Vladimir Iliev
Telerik team
Chandrasekhar
Top achievements
Rank 2
Share this question
or