Mithun Pradhan

Mithun Pradhan

  • 1.5k
  • 143
  • 18k

How to show the data in ejs-schedule

Nov 1 2022 12:13 PM

My code

schedular.cshtml <div class="main-content app-content"> <div class="main-container container-fluid"> <div class="breadcrumb-header justify-content-between"> <div class="my-auto"> <div class="d-flex"> <h4 class="content-title mb-0 my-auto">Calendar</h4> </div> </div> </div> <div class="left-content"> <div> <div class="control-section"> <ejs-schedule id="schedule" height="650" selectedDate="new DateTime(DateTime.Today.Year, 2, 15)" eventRendered="onEventRendered"> <e-schedule-eventsettings dataSource="@Model.CalendarViewModel"></e-schedule-eventsettings> </ejs-schedule> </div> </div> </div> </div> </div> @section Scripts { <script src="~/scripts/schedule/applyCategoryColor.js"></script> <script type="text/javascript"> function onEventRendered(args) { var scheduleObj = document.getElementById('schedule').ej2_instances[0]; var categoryColor = args.data.CategoryColor; if (!args.element || !categoryColor) { return; } if (scheduleObj.currentView === 'Agenda') { (args.element.firstChild).style.borderLeftColor = categoryColor; } else { args.element.style.backgroundColor = categoryColor; } } </script> } }

schedular.cshtml.cs

public async Task OnGet(int id) { CalendarViewModel = await _manageRequisitionFormService.GetScheduleDetailsAsync(id); }

OutPut

-----------------

Actually return in my database is  ToDate 2022-10-18 11:41:02.133   From Date 2022-10-17 11:41:02.133      DownFrom 2022-09-30 19:33:00.000    DownTo 2022-10-01 19:33:00.000
ToDate 2022-11-18 18:33:00.000    From Date 2022-11-08 18:33:00.000      DownFrom  2022-09-30 19:33:00.000    DownTo 2022-10-01 19:33:00.000

Show these data in schedular (only view those data)