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

Scheduler Not Updating When Filtering With No Data Returned

4 Answers 59 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 19 May 2015, 02:49 PM

I have a Scheduler bound to an ObjectDataSource that I want to filter using a dropdown list of Categories.  I have a ControlParameter as a SelectParameter on the ObjectDataSource tied to this dropdown.  My filtering works fine if I select an Category that has appointments associated with it and actually returns rows.  However, if I select a Category that does not have any appointments associated with it and returns no rows, the Scheduler never updates and continues to show the previous list of appointments instead of showing no appointments.  Any idea on why the Scheduler won't refresh and properly show no appointments in this situation?

 

4 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 22 May 2015, 07:34 AM
Hi,

We are not aware of such issue with RadScheduler filtering in server side binding. You can refer to this sample demo where the appointments are filtered depending on checkboxes and this functionality is still working correctly event when unchecking all of them. 

Regards,
Plamen
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
0
Michael
Top achievements
Rank 1
answered on 26 May 2015, 11:59 AM

In that demo, you aren't filtering on the datasource though, you're simply returning all rows and then filtering.  The problem occurs if you filter the datasource itself using SelectParameters and it returns no rows.  As an example, I have a dropdown list of categories that is used as a ControlParameter on my datasource as defined below.  When I initially visit the page, all appointments are loaded because no category is selected.  If I select a category that has no appointments and thus the datasource returns 0 rows, instead of showing no appointments, the calendar still displays all appointments.

 

I think if you modify your that demo example and add a dropdown list of Rooms and modify the SqlDataSource as shown below, you should be able to reproduce the issue.  It doesn't look like any of the appointments in that demo are assigned to a room number, so as soon as you try to select a room from the dropdownlist, it should filter the datasource such that the select statement returns 0 rows. However the calendar itself will not update and will continue to show all appointments.  Again, the issue seems to arise when the datasource goes from returning greater than 0 rows, to returning exactly 0 rows.

<asp:DropDownList runat="server" ID="ddlRooms" DataSourceID="RoomsDataSource" DataTextField="RoomName" DataValueField="ID" AppendDataBoundItems="true" AutoPostBack="true">
    <asp:ListItem Text="" Value="0"></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="AppointmentsDataSource" runat="server"
    ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString35 %>"
    SelectCommand="SELECT * FROM [Appointments] Where @RoomID = 0 Or (@RoomID <> 0 And RoomID = @RoomID)" InsertCommand="INSERT INTO [Appointments] ([Subject], [Start], [End], [RoomID], [UserID], [RecurrenceRule], [RecurrenceParentID]) VALUES (@Subject, @Start, @End , @RoomID, @UserID, @RecurrenceRule, @RecurrenceParentID)"
    UpdateCommand="UPDATE [Appointments] SET [Subject] = @Subject, [Start] = @Start, [End] = @End, [RoomID] = @RoomID, [UserID] = @UserID, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID WHERE (ID = @ID)"
    DeleteCommand="DELETE FROM [Appointments] WHERE [ID] = @ID">
    <SelectParameters>
        <asp:ControlParameter ControlID="ddlRooms" PropertyName="SelectedValue" Name="RoomID" Type="Int32" />
    </SelectParameters>
    <DeleteParameters>
        <asp:Parameter Name="ID" Type="Int32"></asp:Parameter>
    </DeleteParameters>
    <UpdateParameters>
        <asp:Parameter Name="ID" Type="Int32"></asp:Parameter>
        <asp:Parameter Name="Subject" Type="String"></asp:Parameter>
        <asp:Parameter Name="Start" Type="DateTime"></asp:Parameter>
        <asp:Parameter Name="End" Type="DateTime"></asp:Parameter>
        <asp:Parameter Name="RoomID" Type="Int32"></asp:Parameter>
        <asp:Parameter Name="UserID" Type="Int32"></asp:Parameter>
        <asp:Parameter Name="RecurrenceRule" Type="String"></asp:Parameter>
        <asp:Parameter Name="RecurrenceParentID" Type="Int32"></asp:Parameter>
    </UpdateParameters>
    <InsertParameters>
        <asp:Parameter Name="Subject" Type="String"></asp:Parameter>
        <asp:Parameter Name="Start" Type="DateTime"></asp:Parameter>
        <asp:Parameter Name="End" Type="DateTime"></asp:Parameter>
        <asp:Parameter Name="RoomID" Type="Int32"></asp:Parameter>
        <asp:Parameter Name="UserID" Type="Int32"></asp:Parameter>
        <asp:Parameter Name="RecurrenceRule" Type="String"></asp:Parameter>
        <asp:Parameter Name="RecurrenceParentID" Type="Int32"></asp:Parameter>
    </InsertParameters>
</asp:SqlDataSource>

 

0
Dimitar Terziev
Telerik team
answered on 29 May 2015, 07:20 AM
Hello,

I have modified the demo as per your suggestion and the RadScheduler behaves correctly when the data source is filtered by room. Here is a video of the behaviour at my end. The sample which I have tested with is attached.

Regards,
Dimitar Terziev
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
0
Michael
Top achievements
Rank 1
answered on 29 May 2015, 11:32 AM
Thanks, I was able to solve my problem.  My datasource was returning null if no rows were retrieved, which was causing the issue.  I changed it to return an empty datatable instead, and it now functions properly.
Tags
Scheduler
Asked by
Michael
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Michael
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Share this question
or