Hi,
I am binding the schedule data from database. while debugging the code, i m seeing the GetScheduleData() method returning the data from database. But it is not binding in schedule control. while giving hardcode value in that method like this
new AppointmentData { Id = 1, StartTime = new DateTime(2020, 3, 10, 9, 30, 0) , EndTime = new DateTime(2020, 3, 10, 12, 0, 0) }
It is binding in schedular control.
My complete code snippet is like given below. could you please let me know, where am i doing mistake ?
<SfSchedule TValue="AppointmentData" Width="900px" Height="700px" AllowDragAndDrop="true"
EnableAutoRowHeight="true" ShowQuickInfo="false"
@bind-CurrentView="CurrentView">
<ScheduleViews>
<ScheduleView Option="View.Day" StartHour="07:00" EndHour="19:00"></ScheduleView>
<ScheduleView Option="View.Week" StartHour="07:00" EndHour="19:00"></ScheduleView>
<ScheduleView Option="View.Month" ShowWeekend="true"></ScheduleView>
<ScheduleView Option="View.TimelineDay" StartHour="07:00" EndHour="19:00"></ScheduleView>
</ScheduleViews>
<ScheduleEvents TValue="AppointmentData" ></ScheduleEvents>
<ScheduleGroup Resources="@Resources"></ScheduleGroup>
<ScheduleResources>
<ScheduleResource TItem="ResourceData" TValue="int" DataSource="@RoomData()"
Field="Id" Title="Room" Name="Rooms"
TextField="RoomText" IdField="Id" AllowMultiple="false">
</ScheduleResource>
</ScheduleResources>
<ScheduleEventSettings DataSource="@GetScheduleData()" EnableTooltip="@EnableTooltip">
<TooltipTemplate>
@{
var eventData = (context as AppointmentData);
<div class="tooltip-wrap">
<div class="content-area">
@eventData.Subject
<div>Tech: @eventData.TechName</div>
<div>Customer: @eventData.Customer</div>
<div>Location: @eventData.Location</div>
<div>Vehicle: @eventData.VehicleName</div>
From : @eventData.StartTime
To : @eventData.EndTime
</div>
</div>
}
</TooltipTemplate>
</ScheduleEventSettings>
</SfSchedule>
------------------------------------------------------------------------------------------
public List<AppointmentData> GetScheduleData()
{
var appData = new List<AppointmentData>();
appData = ScheduleService.GetAllAppointmentData();
return appData;
}
public List<ResourceData> RoomData()
{
var roomData = new List<ResourceData>();
roomData = ScheduleService.GetAllResourceData();
return roomData;
}
public List<WaitData> GetWaitList()
{
var wData = new List<WaitData>();
wData = ScheduleService.GetAllWaitData();
return wData;
}
public List<RepairBays> GetLocationList()
{
var locationlist = new List<RepairBays>();
locationlist = ScheduleService.GetAllLocationData();
return locationlist;
}