Timespans - Error getting zones from the server

Hello,
I am trying to dynamically color the scheduler slots based on working day which could be different for each user or each day.

So, following directions, I have added
scheduler.BeforeInit.Add(“configure();”);
to the controller method

and the following method in the controller
public ContentResult Timespans()
{
var from = DateTime.ParseExact(this.Request.QueryString[“from”], “yyyy-MM-dd”, CultureInfo.InvariantCulture);
var to = DateTime.ParseExact(this.Request.QueryString[“to”], “yyyy-MM-dd”, CultureInfo.InvariantCulture);

        IList<DHXMarkTime> arrayOfTimespans = new List<DHXMarkTime>();

        //set the block time
        arrayOfTimespans.Add(new DHXMarkTime()
        {
            Zones = new List<Zone>() { new Zone { Start = 0, End = 9 * 60 }, new Zone { Start = 17 * 60, End = 24 * 60 } },
            CssClass = "schedule_block",
            FullWeek = true
        }
        );

        //now set the working day styles
        //set the block time
        arrayOfTimespans.Add(new DHXMarkTime()
        {
            Zones = new List<Zone>() { new Zone { Start = 0, End = 9 * 60 }, new Zone { Start = 17 * 60, End = 24 * 60 } },
            InvertZones = true,
            CssClass = "schedule_working",
            FullWeek = true
        }
        );

        return (ContentResult)new SchedulerAjaxData(arrayOfTimespans);
    }

I get everything properly except the zones.
Here is the returned data:

"[{“SpanType”:“Default”,
“CssClass”:“schedule_block”,
“StartDate”:“01/01/0001 0:00”,
“Day”:“Sunday”,
“Zones”:“System.Collections.Generic.List1[DHTMLX.Scheduler.Zone]\", \"Sections\":\"System.Collections.Generic.List1[DHTMLX.Scheduler.Section]”,
“FullDay”:false,
“FullWeek”:true,
“EndDate”:“01/01/0001 0:00”,
“HTML”:null,
“InvertZones”:false},

{“SpanType”:“Default”,
“CssClass”:“schedule_working”,
“StartDate”:“01/01/0001 0:00”,
“Day”:“Sunday”,
“Zones”:“System.Collections.Generic.List1[DHTMLX.Scheduler.Zone]\", \"Sections\":\"System.Collections.Generic.List1[DHTMLX.Scheduler.Section]”,
“FullDay”:false,
“FullWeek”:true,
“EndDate”:“01/01/0001 0:00”,
“HTML”:null,“InvertZones”:true}]"

As you can see, instead of the actual zones, I am getting
“Zones”:“System.Collections.Generic.List`1[DHTMLX.Scheduler.Zone]”,

How do I fix this?

I am using Scheduler.Net version version 3.0.1.10

Thanks,
Mehnaz

Hello,
DHXMarkedTimespan objects are not expected to be serialized to JSON, and there is no built-in support of dynamic loading of marked timespans.

If you want to implement it manually, you may check this article
docs.dhtmlx.com/scheduler/api__s … espan.html

It describes a format of marked timespan configuration, that is expected on the client side. You can define custom class of similar structure and use it to load timespan data to the client. On the client-side you’ll have to parse loaded data and add it to the scheduler using scheduler.addMarkedTimespan.
Zones can be passed as a plain array of integers
docs.dhtmlx.com/scheduler/api__s … html#zones