AppointmentDataBound and web services

5 posts, 0 answers
  1. Mitchell
    Mitchell avatar
    24 posts
    Member since:
    Nov 2010

    Posted 14 Sep 2011 Link to this post

    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;
            }
        }
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 14 Sep 2011 Link to this post

    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
  3. Mitchell
    Mitchell avatar
    24 posts
    Member since:
    Nov 2010

    Posted 14 Sep 2011 Link to this post

    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?
  4. Mitchell
    Mitchell avatar
    24 posts
    Member since:
    Nov 2010

    Posted 16 Sep 2011 Link to this post

    *bump*

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

  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 17 Sep 2011 Link to this post

    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
Back to Top