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

[Solved] Dynamic ResourceStyles w/Multiple Resources

2 Answers 102 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 2
Mike asked on 01 Apr 2009, 07:55 PM

Nice feature adding in ResourceStyles, I'd like to integrate with my current app.  I'm using a custom data provider so I can support multiple resources (classes and classrooms, classes can be in multiple classrooms) 

I'm currently doing this below:

List<Room> roomList = GetRoomList(); //returns list of rooms (ID, Name, Abbreviation, ScheduleColor);  
foreach (Room room in roomList)  
{  
    schedulerMain.ResourceStyles.Add(new ResourceStyleMapping("Room", room.RoomID.ToString(), room.Name, room.ScheduleColor));  

This works great, except for appointments with multiple resources.  So I figure on AppointmentDataBound, if the appointment has more than one resource, remove it and use a default style.  How do I remove the current resource style that is applied, ie. something like this:

 

protected void schedulerMain_AppointmentDataBound(object sender, SchedulerEventArgs e)  
{  
    List<Resource> resources = (List<Resource>)e.Appointment.Resources.GetResourcesByType("Room");  
    if (resources.Count > 1)  
    {  
        //use different resource style  
    }  

I appreciate any help you can send my way, thanks guys!

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 02 Apr 2009, 10:46 AM
Hello Michael,

You can try setting the CssClass property of the appointment to any of the predefined colors:

e.Appointment.CssClass = "rsCategoryGreen"

All the best,
Albert
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Mike
Top achievements
Rank 2
answered on 02 Apr 2009, 02:18 PM
I think I tried everything except that, keep it simple, thanks for your help!
Tags
Scheduler
Asked by
Mike
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
Mike
Top achievements
Rank 2
Share this question
or