I am trying to do a filter function for my RadScheduler, with a .NET checkboxlist as filter UI control. However, on the AppointmentDataBound event, I cant seem to get anything but NULL from the
e.Appointment.Resources.GetResource function.
Heres my event code:
protected
void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
{
e.Appointment.Visible =
true;
foreach (ListItem item in CheckBoxList1.Items)
{
if (item.Selected)
{
Resource userRes = e.Appointment.Resources.GetResource("Vogne", item.Value);
if (userRes != null)
{
e.Appointment.Visible =
true;
}
}
}
}
And here's a part of my markup:
<
telerik:RadScheduler ID="RadScheduler1" runat="server" DataDescriptionField="Description"
DataEndField="End" DataKeyField="ID" DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID"
DataSourceID="sdsSchedule" DataStartField="Start" DataSubjectField="Subject"
EnableDescriptionField="True" Skin="Vista" Culture="Danish (Denmark)" FirstDayOfWeek="Monday"
Height="100%" LastDayOfWeek="Sunday" SelectedView="WeekView" OnAppointmentCreated="RadScheduler1_AppointmentCreated"
OnFormCreated="RadScheduler1_FormCreated" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound">
<ResourceTypes>
<telerik:ResourceType DataSourceID="sdsCategoryA" ForeignKeyField="CategoryA" KeyField="catid"
Name="Vogne" TextField="catname" />
</ResourceTypes>
<AppointmentTemplate>
<div>
<b>
<%
# Eval("Subject") %>(<%# DataBinder.Eval(Container.Appointment, "Start", "{0:t}") %>-<%# DataBinder.Eval(Container.Appointment, "End", "{0:t}") %>)</b><br />
<%
# Eval("Vogne.Text") %>
</div>
</AppointmentTemplate>
</telerik:RadScheduler>
...
...
<
telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px">
<asp:CheckBoxList ID="CheckBoxList1" runat="server" AutoPostBack="True" DataSourceID="sdsCategoryA"
DataTextField="catname" DataValueField="catid" OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged">
</asp:CheckBoxList>
</telerik:RadAjaxPanel
As you can see, I have a resource, and the CheckBoxList uses the same datasource as the resourceprovider in the Scheduler.
On inserting break point on Resource userRes = e.Appointment.Resources.GetResource("Vogne", item.Value); I can see that the resource has an item that matches my selcted item from the CheckBoxList, but it still evaluates to NULL.
Please HEEELLLP :-)
Regards
Jesper