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

Order by Resource items

1 Answer 54 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
GlenB
Top achievements
Rank 1
GlenB asked on 19 Nov 2010, 06:28 AM
I am trying to get my scheduler entries to show up in order of a resource (called PeriodID). The resource is used to store the ID of the Period selected (from the Period Table) as follows:

On Call (ID=1)
AM (ID=2)
PM (ID=3)
All Day (ID=4)

I am using SQL Datasources for binding.

I have tried using Order By PeriodID in the Datasource Select statement for the Schedule Data but that doesn't work. I then tried creating a class and using the appointmentcomparer as shown here http://www.telerik.com/community/forums/aspnet-ajax/scheduler/oder-of-entry-in-scheduler.aspx#1155620 but that adds another field to the Advanced form for manual PeriodID entry which is not what I need.

Does anyone know how to have the scheduler order entries by Resource? Thanks.

1 Answer, 1 is accepted

Sort by
0
GlenB
Top achievements
Rank 1
answered on 24 Nov 2010, 02:26 AM
I received the solution from Peter after submitting a support ticket. For anyone needing this solution the answer is below:

Hello Glen,

You can tweak the code from the forum post to use resource Keys instead of custom attributes. Provided that you have a resource type called "Period", here is how your code should look like:

if (first.Resources.GetResourceByType("Period") != null & second.Resources.GetResourceByType("Period") != null) 

    return String.Compare(first.Resources.GetResourceByType("Period").Key.ToString(), second.Resources.GetResourceByType("Period").Key.ToString()); 
}

Greetings,
Peter
the Telerik team

Tags
Scheduler
Asked by
GlenB
Top achievements
Rank 1
Answers by
GlenB
Top achievements
Rank 1
Share this question
or