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

Trouble using RadScheduler1_AppointmentDataBound

1 Answer 144 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Royal
Top achievements
Rank 1
Royal asked on 13 Mar 2009, 10:36 PM
I am having trouble accessing the AppointmentDataBound class from within an .aspx page rendering a RadScheduler control.

As an example, I would expect to be able to overwrite the stored value for each Subject Item with a local value:

protected

 

void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)

 

{

e.Appointment.Subject =

"TEST";

 

}

What I am aiming to do is to assign colors based on custom resources using a Data Source, which I was unable to get to work, so I hoped to prove the I was actually firing the Data Bound event by testing it with the Subject change.

Here is an example oh how I would like to display colors for different resources ("CalendarType"):

protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)

 

{

if (e.Appointment.Resources.GetResourceByType("CalendarType") != null)

            e.Appointment.CssClass = DataBinder.Eval(e.Appointment.Resources.GetResourceByType("CalendarType").DataItem, "CalendarTypeColor").ToString();
}

Thanks in advance. You guys have a great product and we will purchase once we solve this problem!

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 17 Mar 2009, 12:48 PM
Hi,

Actually, this is a very common scenario so we decided to add a new feature with Q1 2009 to RadScheduler to allow an easier and more elegant implementation of this. The new property is ResourceStyleMapping and is demonstrated in several online examples which use Resources, such as the Defining Resources example: 

<ResourceStyles> 
                    <telerik:ResourceStyleMapping Type="User" Text="Alex" ApplyCssClass="rsCategoryBlue" /> 
                    <telerik:ResourceStyleMapping Type="User" Text="Bob" ApplyCssClass="rsCategoryOrange" /> 
                    <telerik:ResourceStyleMapping Type="User" Text="Charlie" ApplyCssClass="rsCategoryGreen" /> 
                </ResourceStyles> 
 


Greetings,
Peter
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Scheduler
Asked by
Royal
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or