Hello Tom,
Thank you for writing.
Your question has already been answered in the support thread you have opened on the same topic. However, I am posting the answer here as well in order the community to benefit from it. In order to filter the resources in
RadScheduler, you can set the new
DataSource with the filtered data. Here is a sample code snippet demonstrating how to filter the resources by using a
RadCheckedDropDownList:
DataTable dt =
new
DataTable();
SchedulerBindingDataSource schedulerBindingDataSource =
new
SchedulerBindingDataSource();
ResourceMappingInfo resourceMappingInfo =
new
ResourceMappingInfo();
public
Form1()
{
InitializeComponent();
dt.Columns.Add(
"Id"
,
typeof
(
int
));
dt.Columns.Add(
"Name"
,
typeof
(
string
));
dt.Columns.Add(
"Color"
,
typeof
(Color));
for
(
int
i = 1; i <= 10; i++)
{
dt.Rows.Add(i,
"Resource"
+ i, Color.Yellow);
}
resourceMappingInfo.Id =
"Id"
;
resourceMappingInfo.Name =
"Name"
;
resourceMappingInfo.Color =
"Color"
;
schedulerBindingDataSource.ResourceProvider.Mapping = resourceMappingInfo;
schedulerBindingDataSource.ResourceProvider.DataSource = dt;
this
.radScheduler1.DataSource = schedulerBindingDataSource;
this
.radScheduler1.GroupType = GroupType.Resource;
this
.radScheduler1.ActiveView.ResourcesPerView = dt.Rows.Count;
this
.radCheckedDropDownList1.DataSource = dt;
this
.radCheckedDropDownList1.DisplayMember =
"Name"
;
this
.radCheckedDropDownList1.ValueMember =
"Id"
;
foreach
(RadCheckedListDataItem item
in
this
.radCheckedDropDownList1.Items)
{
item.Checked =
true
;
}
this
.radCheckedDropDownList1.ItemCheckedChanged += radCheckedDropDownList1_ItemCheckedChanged;
}
private
void
radCheckedDropDownList1_ItemCheckedChanged(
object
sender, RadCheckedListDataItemEventArgs e)
{
StringBuilder sb =
new
StringBuilder();
foreach
(RadCheckedListDataItem item
in
this
.radCheckedDropDownList1.CheckedItems)
{
sb.Append(
"Id = "
+ item.Value +
" or "
);
}
sb.Remove(sb.Length - 3, 2);
DataView dv =
new
DataView(dt);
dv.RowFilter = sb.ToString();
schedulerBindingDataSource.ResourceProvider.DataSource = dv;
}
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the
Telerik API Analyzer and share your thoughts.