This is a migrated thread and some comments may be shown as answers.

AppointmentDataBound and web services

4 Answers 34 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Mitchell
Top achievements
Rank 1
Mitchell asked on 14 Sep 2011, 02:56 PM
Guys,

I previously had my scheduler set up to be the regular way, server side w/ postbacks, and I had a lot of custom functionality built into the AppointmentDataBound function that now doesn't work because I'm running web services binding.

How can I build this functionality with web services binding? It's key to my project working.

Even my Category resource list is managed via the database, so I can't use the static resource coloring feature.

Thoughts?

protected void radAppointments_AppointmentDataBound(object sender, SchedulerEventArgs e) {
        if (e.Appointment.Resources.GetResourceByType("Category") != null) {
            bvAppointmentCategory c = new bvAppointmentCategory(int.Parse(e.Appointment.Resources.GetResourceByType("Category").Key.ToString()));
            e.Appointment.CssClass = c.CssClass;
        }

        if (e.Appointment.ID != null) {
            bvAppointmentDoctor a;

            if (e.Appointment.RecurrenceParentID == null) {
                a = new bvAppointmentDoctor(int.Parse(e.Appointment.ID.ToString()));
            } else {
                a = new bvAppointmentDoctor(int.Parse(e.Appointment.RecurrenceParentID.ToString()));
            }

            String subject = e.Appointment.Subject;
            String client_name = "";
            String pet_name = "";
            String confirmed = "";

            if (a.ClientID != null) {
                bvClient client = new bvClient(a.ClientID.Value);
                client_name = " w/ " + client.PrimaryFirstName + " " + client.PrimaryLastName + " @ " + client.PrimaryPhoneHome;
            }

            if (a.PetID != null) {
                bvPet p = new bvPet(a.PetID.Value);
                pet_name = " (" + p.Name + ")";
            }

            if (e.Appointment.RecurrenceState == 0) {
                if (a.Confirmed) {
                    confirmed = " Confirmed? - [X]";
                } else {
                    confirmed = " Confirmed? - [ ]";
                }
            }

            e.Appointment.Subject = subject + client_name + pet_name + confirmed;
        }

        if (c_security_level < 2) {
            e.Appointment.AllowDelete = false;
        }
    }

4 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 14 Sep 2011, 03:34 PM
Hello Mitchell,

You can use OnClientAppointmentDataBound and the Client API. For example:
function OnClientAppointmentDataBound(sender, args) {
          args.get_appointment().set_backColor("red");
      }


All the best, Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
0
Mitchell
Top achievements
Rank 1
answered on 14 Sep 2011, 03:41 PM
Peter,

I would need more detail. If you look at the code I provided, you'll see I'm accessing the appointment database object and doing a lot of manipulation to it. Even in getting the category color, I access the category database object. Is there a solution for this?
0
Mitchell
Top achievements
Rank 1
answered on 16 Sep 2011, 03:30 PM
*bump*

If anyone could please offer any advice on my response, it'd be greatly appreciated. We're at a standstill right now :(

0
Peter
Telerik team
answered on 17 Sep 2011, 09:45 AM
Hello Mitchell,

I recommend  you store the value of the appointment's color in a custom attribute and then use it to set the BackColor property in OnClientAppointmentDataBound. You can download a working sample from here and test the functionality.

Best wishes, Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
Tags
Scheduler
Asked by
Mitchell
Top achievements
Rank 1
Answers by
Peter
Telerik team
Mitchell
Top achievements
Rank 1
Share this question
or