Set Default Value for Event Fields in ASP.NET Core Scheduler
The default field names displayed in the event editor window (such as Title, Location, etc.) can be customized, and a default value can be set for the Subject field using the Default property. This default value is applied to an appointment when it is created with an empty Subject.
@using Syncfusion.EJ2.Schedule
<ejs-schedule id="schedule" height="550" selectedDate="new DateTime(2018, 2, 15)">
<e-schedule-eventsettings dataSource="@ViewBag.datasource">
<e-eventsettings-fields>
<e-field-subject title="Event Name" name="Subject" default="Add Name"></e-field-subject>
<e-field-location title="Event Location" name="Location"></e-field-location>
<e-field-description title="Summary" name="Description"></e-field-description>
<e-field-starttime title="From" name="StartTime"></e-field-starttime>
<e-field-endtime title="To" name="EndTime"></e-field-endtime>
</e-eventsettings-fields>
</e-schedule-eventsettings>
</ejs-schedule>public ActionResult Index()
{
ViewBag.datasource = GetScheduleData();
return View();
}
public List<AppointmentData> GetScheduleData()
{
List<AppointmentData> appData = new List<AppointmentData>();
appData.Add(new AppointmentData
{ Id = 1, Subject = "Blue Moon Eclipse", StartTime = new DateTime(2018, 2, 13, 9, 30, 0), EndTime = new DateTime(2018, 2, 13, 11, 0, 0) });
appData.Add(new AppointmentData
{ Id = 2, Subject = "Milky Way as Melting pot", StartTime = new DateTime(2018, 2, 15, 9, 30, 0), EndTime = new DateTime(2018, 2, 15, 11, 0, 0) });
return appData;
}
public class AppointmentData
{
public int Id { get; set; }
public string Subject { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
}