ComponentOne Scheduler for ASP.NET: Working with Scheduler for ASP.NET AJAX > Appointments > Categories > Assigning Categories to an Appointment

Assigning Categories to an Appointment

At run time, assigning a category or multiple categories to an appointment can be done through the Categories dialog box. By default, there is a list of twenty predefined categories. For more information on how to add categories to the Categories dialog box, see Adding Categories to the Master Categories List.

To assign a category to an appointment at run time:

1.   Click the Categories button in the Appointment dialog box.

2.   Select the check box next to the desired category and click OK:

 

 

The category appears next to the Categories text box. Note that you can assign multiple categories to an appointment.

To assign a category to an appointment programmatically:

Suppose you have already created an appointment and added a category using the following code in the Page_Load event, for example:

      Visual Basic

' Add a new appointment.

Dim app As C1.C1Schedule.Appointment

app = Me.C1Schedule1.DataStorage.AppointmentStorage.Appointments.Add()

 

' Set some details for the appointment.

app.Subject = "Meeting"

app.Location = "Large Conference Room"

app.Duration = TimeSpan.FromMinutes(45)

app.Start = New Date(2009, 2, 26, 11, 30, 0)

 

' Create a new Vacations category.

Dim newCat As C1.C1Schedule.CategoryCollection

newCat = Me.C1Schedule1.DataStorage.CategoryStorage.Categories

Dim category As New C1.C1Schedule.Category

category.Text = "Vacations"

 

'Insert the new Vacations category at the top of the Master Categories List.

newCat.Insert(0, category)

      C#

// Add a new appointment.

C1.C1Schedule.Appointment app;

app = this.C1Schedule1.DataStorage.AppointmentStorage.Appointments.Add();

 

// Set some details for the appointment.

app.Subject = "Meeting";

app.Location = "Large Conference Room";

app.Duration = TimeSpan.FromMinutes(45);

app.Start = new DateTime(2009, 2, 26, 11, 30, 0);

 

// Create a new Vacations category.

C1.C1Schedule.CategoryCollection newCat;

newCat = this.C1Schedule1.DataStorage.CategoryStorage.Categories;

C1.C1Schedule.Category category = new C1.C1Schedule.Category();

category.Text = "Vacations";

 

// Insert the new Vacations category at the top of the Main List of Categories.

newCat.Insert(0, category);

To assign the new category to the appointment you created, use the following code:

      Visual Basic

' Assign the category to the appointment.

app.Categories.Add(category)

      C#

// Assign the category to the appointment.

app.Categories.Add(category);


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.