Binds the Scheduler's resources to the specified resource collection.
Namespace: DevExpress.AspNetCore.Bootstrap
Assembly: DevExpress.AspNetCore.Bootstrap.v18.2.dll
public T BindResources(
object dataObject
)
Public Function BindResources(
dataObject As Object
) As T
Type | Name | Description |
---|---|---|
Object | dataObject | An collection of resources. |
Type | Description |
---|---|
TT | A reference to this instance after the operation is completed. |
Pass a collection of resource data objects to the BindResources method to provide resource data to the scheduler.
@model EditableMedicsDataContext
@(Html.DevExpress()
.BootstrapScheduler<MedicalAppointment, Medic>("scheduler1")
.Storage(storage => storage
.Appointments(appointments => appointments
.Mappings(map => map
.ResourceId(a => a.MedicId)
.AppointmentId(a => a.ID)
.Start(a => a.StartTime)
.End(a => a.EndTime)))
.Resources(resources => resources
.Mappings(map => map
.ResourceId(r => r.ID)
.Caption(r => r.DisplayName))))
.BindAppointments(Model.GetAppointments())
.BindResources(Model.GetMedics())
.Routes(routes => routes
.MapRoute(r => r
.Controller("Scheduler")
.Action("DataBinding"))))
public partial class SchedulerController : Controller {
public SchedulerController(AppointmentsWithResourcesDataContext dataContext){
AppointmentsWithResourcesDataContext = dataContext;
}
AppointmentsWithResourcesDataContext AppointmentsWithResourcesDataContext {get;}
public IActionResult ResourcesDataBinding() {
return PartialView("SchedulerPartial", AppointmentsWithResourcesDataContext);
}
}
Note that to allow the Scheduler control to save and retrieve resource data to/from the data source, you also need to specify at least the following mandatory data field mappings: