Giving color to C1Schedule appointment individually

Posted by: chetankulkarni789 on 10 September 2017, 11:42 am EST

  • Posted 10 September 2017, 11:42 am EST

    hi,
    I am using C1schedule control for ASP.net and I am adding appointment to it
    below is my sample code

    C1.C1Schedule.Appointment oppoint = new C1.C1Schedule.Appointment();
    oppoint.Start=DateTime.Now.AddHours(1);
    oppoint.End =DateTime.Now.AddHours(2);
    oppoint.Subject = "Urgent Care";
    C1Schedule1.DataStorage.AppointmentStorage.Appointments.Clear();
    C1Schedule1.DataStorage.AppointmentStorage.Appointments.Add(oppoint);

    So it was adding Appointment to the Schedule. But If I would like to give Color to that Appointment then I am not getting its color Property.
    so Can any body help me for giving Color to each Individual Appointment.
  • Replied 10 September 2017, 11:42 am EST

    Hi Chetan,

    To give different colors to individual appointments, you can create your own custom label as follows:

    C1Schedule1.DataStorage.AppointmentStorage.Appointments.Clear();

    C1.C1Schedule.Label label1 = new C1.C1Schedule.Label();
    label1.Color = System.Drawing.Color.Violet;
    label1.Text = "CustomLabel1";
    label1.MenuCaption = "CustomLabel1";
    C1Schedule1.DataStorage.LabelStorage.Labels.Add(label1);

    C1.C1Schedule.Appointment app = new C1.C1Schedule.Appointment();
    app.Start = DateTime.Now.AddMinutes(30);
    app.End = DateTime.Now.AddMinutes(35);
    app.Subject = "New Appointment" + DateTime.Now.Minute.ToString();
    // assign the custom label to the appointment
    app.Label = label1;
    C1Schedule1.DataStorage.AppointmentStorage.Appointments.Add(app);


    Regards
  • Replied 10 September 2017, 11:42 am EST

    Thanks for Reply,

    Can I able to use these control in Share point Web Part.
  • Replied 10 September 2017, 11:42 am EST

    We have a different suite for Sharepoint webparts. Please refer to the following link for details :
    http://www.componentone.com/SuperProducts/SharePointWebParts/

    If you still want to use the asp.net controls in Sharepoint, please refer to the following link which might be helpful : http://blogs.technet.com/b/vedant/archive/2009/01/22/using-custom-asp-net-controls-in-sharepoint-2007.aspx

    Regards
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels