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

Group Header in code behind

6 Answers 145 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Marcus
Top achievements
Rank 1
Marcus asked on 02 Apr 2013, 10:16 AM
Hello.

I have a problem creating group-headers for a RadScheduleView from code behind.
I want to have multiple header in a timeline-view, one for each selected user. I use custom appointments, which have the UserID within.

My code looks like this at the moment:
ResourceTypeCollection Group = new ResourceTypeCollection();
ResourceType User = new ResourceType("User");
 
for (int i = 0; i < UserGroup.UserIDs.Count; i++)
{
 
        Resource Person = new Resource();
        Person.ResourceName = UserGroup.UserIDs[i];               
        Person.DisplayName = UserGroup.UserName[i];
        User.Resources.Add(Person);
     
}
 
Group.Add(User);
ScheduleView.ResourceTypesSource = Group;

But when displayed, there appears not a single header.

6 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 05 Apr 2013, 09:13 AM
Hello Marcus,

Thank you for contacting us.

Have you set the GroupDescriptionsSource property of the ScheduleView - it is needed to enable the grouping? You can check here for more details.

Regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Marcus
Top achievements
Rank 1
answered on 05 Apr 2013, 02:26 PM
Well, okay, Headers are shown now.

But not a single appointment appears...
0
Yana
Telerik team
answered on 08 Apr 2013, 08:28 AM
Hi Marcus,

When RadScheduleView is grouped by ResourceType, only the appointments that have Resource assigned are shown. To display all the appointments, you should set ShowNullGroup property of the ResourceGroupDescription like this:

<telerik:RadScheduleView.GroupDescriptionsSource>
    <telerik:GroupDescriptionCollection>
        <telerik:ResourceGroupDescription ResourceType="User" ShowNullGroup="True" />
        <telerik:DateGroupDescription />
    </telerik:GroupDescriptionCollection>
</telerik:RadScheduleView.GroupDescriptionsSource>

Hope it is ok now.

Regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Marcus
Top achievements
Rank 1
answered on 09 Apr 2013, 08:33 AM
Thanks for help Yana. Appointments are shown now, but that was not exactly what I want.

I want the appointments to be shown in the correct groupheader. One Header for each user in the group.

Resource User = new Resource();
User.ResourceName = UserGroup.UserIDs[i];              
User.DisplayName = UserGroup.UserName[i];


And this appointment:
public class customAppointment : Appointment
{
 
           [...]
       

        private string userID;
        public string UserID { get {return userID;} set {userID = value;} }
 
}


I want to assign the UserID-property in the appointment to the list 'UserGroup.UserIDs'. An appointment belonging to the user with ID = '0001' for example, should be shown in the groupheader name: '0001', which is displayed as 'UserGroup.UserName'.

At this moment, all appointments are shown in the nullgroup. No appointment is shown in 'his' correct groupheader.
0
Yana
Telerik team
answered on 09 Apr 2013, 12:28 PM
Hello Marcus,

The appointments will be shown in the correct resource group only if this resource is added to the Resources collection of each appointment.  Note that RadScheduleView cannot connect the custom property of the appointment to the corresponding resource automatically.

So when creating appointments, you should add the following:

app.Resources.Add(User.Resources.Where(p => p.ResourceName == app.UserID).First());

In other words, find the resource whose ResourceName is the same as UserID and assign it to the appointment.

I hope this helps.

Greetings,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Marcus
Top achievements
Rank 1
answered on 09 Apr 2013, 01:30 PM
Thank you. Everything works fine now.
Tags
ScheduleView
Asked by
Marcus
Top achievements
Rank 1
Answers by
Yana
Telerik team
Marcus
Top achievements
Rank 1
Share this question
or