Hello Emad,
Thank you for writing.
Please refer to the following code snippet demonstrating how to get the resources id for the current view:
public
Form1()
{
InitializeComponent();
//populate with resources
GroupByResources();
}
private
void
GroupByResources()
{
Color[] colors =
new
Color[]
{
Color.LightBlue, Color.LightGreen, Color.LightYellow,
Color.Red, Color.Orange, Color.Pink, Color.Purple, Color.Peru, Color.PowderBlue
};
string
[] names =
new
string
[]
{
"Alan Smith"
,
"Anne Dodsworth"
,
"Boyan Mastoni"
,
"Richard Duncan"
,
"Maria Shnaider"
};
for
(
int
i = 0; i < names.Length; i++)
{
Resource resource =
new
Resource();
resource.Id =
new
EventId(i);
resource.Name = names[i];
resource.Color = colors[i];
this
.radScheduler1.Resources.Add(resource);
}
this
.radScheduler1.GroupType = GroupType.Resource;
}
private
void
radButton1_Click(
object
sender, EventArgs e)
{
//get resources id for the current view
SchedulerDayViewGroupedByResourceElement dayView =
this
.radScheduler1.ViewElement
as
SchedulerDayViewGroupedByResourceElement;
foreach
(RadElement el
in
dayView.Children)
{
SchedulerDayViewElement d = el
as
SchedulerDayViewElement;
if
(d !=
null
)
{
SchedulerResourceCollection resources = d.View.GetResources();
foreach
(Resource r
in
resources)
{
Console.WriteLine(r.Id);
}
}
}
}
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items