а

Load data to scheduler from C# list


#1

I’m trying to load data to my scheduler from C# list like this:

<script type="text/javascript">


scheduler.init(“scheduler_here”);
@ foreach (var myevent in schedulerEvents)
{

scheduler.addEvent({
start_date: @ myevent.start_date,
end_date: @ myevent.end_date,
text: @ myevent.text;
});
};

}

schedulerEvents list contains object of this class:

public class SchedulerEvent
{
public DateTime start_date;
public DateTime end_date;
public String text;

        public SchedulerEvent(DateTime start, DateTime end, String text)
        {
            this.start_date = start;
            this.end_date = end.AddHours(1);//visit take always 1 hour
            this.text = text;
        }
    }

Code compile but I have only partially initialized scheduler. I can’t even see this events. Only pagging arrows and “today” button are displayed. What is wrong? Please help me.


#2

Hi,

Pleae check that you set the date format that is used to parse data from a data set in the date_format config:
https://docs.dhtmlx.com/scheduler/api__scheduler_date_format_config.html

If that doesn’t help to solve the issue, please send the demo that I can run locally.