We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Databind my customized appointment window

Thread ID:

Created:

Updated:

Platform:

Replies:

127363 Nov 10,2016 04:15 AM Nov 14,2016 06:30 AM ASP.NET Web Forms 4
loading
Tags: Schedule
brian jumaquio
Asked On November 10, 2016 04:15 AM

I was able to customized my appointment window when I clicked in a empty space. I understand that I can get my new field in save() function, let's say ojb["MyField"] = $("#myfield)[0].value. My problem is how can I populate this 'myfield' from my database?

Based from the documentation, these are the properties for appointments I believe,

 public class ScheduleData
        {
            public int Id { get; set; }
            public string Subject { get; set; }
            public DateTime StartTime { get; set; }
            public DateTime EndTime { get; set; }
            public Boolean AllDay { get; set; }
            public Boolean Recurrence { get; set; }
            public string RecurrenceRule { get; set; }
            public string StartTimeZone { get; set; }
            public string EndTimeZone { get; set; }
            public string Description { get; set; }
        }

So how can I databind my 'myfield'? Because what I want is not part of the AppointmentSettings.


Karthigeyan Krishnamurthi [Syncfusion]
Replied On November 11, 2016 09:35 AM

Hi Brian, 
 
Thank you for contacting Syncfusion support. 
 
We have prepared the sample to bind the additional field value in custom appointment window which can be download from the below location: 
 
In the above sample additionally drop down field is added to the custom window sample. When an appointment is saved with some values in drop down field, it is saved in data base and will be retirved while double clicking an appointment. 
 
Regards, 
Karthigeyan 
 


brian jumaquio
Replied On November 11, 2016 11:13 AM

Thank you for your response. But that's not the answer I was looking for.  Yes, I was able to follow how to save the data back at the server-side. What I meant is that how to save and retrieve data when I have new fields not included in the AppointmentSettings. Let's say I wanted to include 2 more properties, let's say public string MyDescription {get;set;} and public int AnotherInt {get;set;}. Is that possible? I downloaded the demo you provided and all you did was used the same properties in the default AppointmentSettings and you did not used the additional "MyField". Thank you anyway

brian jumaquio
Replied On November 12, 2016 09:29 AM

I think I need to rephrase what I said. Can anyone point me to the right direction how to databind my additional properties? Anyone?

Karthigeyan Krishnamurthi [Syncfusion]
Replied On November 14, 2016 06:30 AM

Hi Brian,    
   
We regret for the inconvenience caused.   
   
To save and retrieve the data of the newly added fields which are not in the AppointmentSettings, explicit handling of those data fields while saving and retrieving is necessary as depicted below.   
   
For example – We have added a new field Status. The below steps shows how it is processed in each process.   
 
i.)                  Added new field (Status) to the custom appointment window as given below. 
<code> 
              <tr> 
                <td>Status: 
                </td> 
                <td> 
                  <input type="text" id="Status" /> 
                </td> 
   </tr> 
</code> 
 
ii.)                 While saving the appointment, you need to explicitly pass those extra fields to the appointment object before it is passed into the saveAppointment client-side method. 
<code> 
          function save() { 
            -------- 
            -------- 
            obj["Status"] = $("#Status")[0].value; // here new field is added to an appointment. 
            obj["Recurrence"] = $("#recurrence")[0].checked; 
            ------- 
            ------- 
            var object = $("#Schedule1").data("ejSchedule"); 
            object.saveAppointment(obj); 
            clearFields(); 
                }
</code> 
 
iii.)               To retrieve those additional details of the appointments while opening the appointment window (by double clicking on the appointments), you need to assign those additional field values to the appointment window fields as follows: 
<code> 
function onAppointmentWindowOpen(args) { 
 ----------- 
           ----------- 
            // here binding the new field value in custom window 
            if (!ej.isNullOrUndefined(args.appointment.Status))  
                   $("#Status").val(args.appointment.Status); 
            else 
         $("#Status").val(""); 
 ----------- 
           ----------- 
} 
</code> 
 
iv.)               Also, while saving the new appointment data to the database in the server-side along with those extra fields, refer to the below code snippet, 
<code> 
protected void Schedule1_ServerAppointmentSaved(object sender, Syncfusion.JavaScript.Web.ScheduleEventArgs e) { 
----------- 
----------- 
sql = "insert into ScheduleAppointments (Id,EndTime,Recurrence,StartTime,Subject,AllDay,Status,RecurrenceRule) values(" + list["Id"].ToString() + ",'" + Convert.ToDateTime(list["EndTime"]).ToUniversalTime().ToString() + "','" + list["Recurrence"].ToString() + "','" + Convert.ToDateTime(list["StartTime"]).ToUniversalTime().ToString() + "','" + list["Subject"].ToString() + "','" + list["AllDay"].ToString() + "','" + list["Status"].ToString() + "','" + recurrenceValue + "')"; 
} 
</code> 
 
We have included the above code snippets and prepared a complete sample to show your required scenario, which can be downloaded from the below location -    
   
Regards,   
Karthigeyan   


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;