RadScheduler with GroupBy Does Not Display Data

7 posts, 0 answers
  1. Brian
    Brian avatar
    68 posts
    Member since:
    Jun 2011

    Posted 10 Jan 2012 Link to this post

    I am using the Q2 2011 version of Telerik's ASP.NET AJAX controls installed with Visual Studio 2010.

    I have dropped a RadScheduler onto my Test.aspx and I am binding it to a SQL Server backend, much like the RadScheduler TimelineView example that is included/installed with the Telerik controls. Everything was good, until I applied a GroupBy to the scheduler control. With the GroupBy included, my data no longer appears in the scheduler control when I browse the Test.aspx.

    The GroupBy was initially assigned to the overall scheduler control, and no data would appear in any of the 4 scheduler views (Day, Week, Month, or Timeline). Then I moved the GroupBy to just the <TimelineView> and I could then see data in every view (Day, Week, and Month), except the Timeline view. If I completely remove the GroupBy from the scheduler, I can once again see data in all 4 views, but I want to be able to group my data.

    I can't locate the cause of the problem. Here is my Test.aspx (there is no code directly behind this aspx):

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
    <%@ Register TagPrefix="sds" Namespace="Telerik.Web.SessionDS" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="scriptMgr" runat="server"></asp:ScriptManager>
            <asp:Panel ID="pnlForScheduler" runat="server">
                <telerik:RadScheduler ID="radScheduler" runat="server" AllowDelete="true"
                    AllowEdit="true" AllowInsert="true"
                    DataSourceID="dsAppts" DataKeyField="ApptID" DataSubjectField="Subject"
                    DataStartField="Start" DataEndField="End" GroupBy="Trucks" <--- Does Not Work Here!
                    OverflowBehavior="Expand" SelectedView="TimelineView">
                    <AdvancedForm Modal="true" />
                    <ResourceTypes>
                        <telerik:ResourceType Name="Trucks" KeyField="TruckID" TextField="TruckName" ForeignKeyField="TruckID" DataSourceID="dsTrucks" />
                    </ResourceTypes>
                    <TimelineView ColumnHeaderDateFormat="MM/dd/yyyy" GroupBy="Trucks" <--- Does Not Work Here Either!
                                  GroupingDirection="Vertical" NumberOfSlots="7" SlotDuration="1.00:00:00" TimeLabelSpan="1" UserSelectable="true" />
                </telerik:RadScheduler>
            </asp:Panel>
            <sds:SessionDataSource ID="dsAppts" runat="server" DisplayWarning="false"
            PrimaryKeyFields="ApptID" ProviderName="System.Data.SqlClient"
            ConnectionString="Server=Test\SQLExpress;Initial Catalog=Appointments;UID=sa;Pwd=123456789"
            SelectCommand="SELECT ApptID, [Subject], Start, [End], UserID, TruckID FROM tblAppointments"
            InsertCommand="INSERT INTO tblAppointments([Subject], Start, [End], UserID, TruckID) VALUES(@Subject, @Start , @End, @UserID, @TruckID)"
            UpdateCommand="UPDATE tblAppointments SET [Subject] = @Subject, Start = @Start, [End] = @End, UserID = @UserID, TruckID = @TruckID WHERE ApptID = @ApptID"
            DeleteCommand="DELETE FROM tblAppointments WHERE ApptID = @ApptID">
            <DeleteParameters>
                <asp:Parameter Name="ApptID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Subject" Type="String" />
                <asp:Parameter Name="Start" Type="DateTime" />
                <asp:Parameter Name="End" Type="DateTime" />
                <asp:Parameter Name="UserID" Type="Int32" />
                <asp:Parameter Name="TruckID" Type="Int32" />
                <asp:Parameter Name="ApptID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Subject" Type="String" />
                <asp:Parameter Name="Start" Type="DateTime" />
                <asp:Parameter Name="End" Type="DateTime" />
                <asp:Parameter Name="UserID" Type="Int32" />
                <asp:Parameter Name="TruckID" Type="Int32" />
            </InsertParameters>
        </sds:SessionDataSource>
        <sds:SessionDataSource ID="dsTrucks" runat="server" DisplayWarning="false"
            ProviderName="System.Data.SqlClient"
            ConnectionString="Server=Test\SQLExpress;Initial Catalog=Appointments;UID=sa;Pwd=123456789"
            SelectCommand="SELECT TruckID, TruckName FROM tblTrucks">
        </sds:SessionDataSource>
        </div>
        </form>
    </body>
    </html>
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 11 Jan 2012 Link to this post

    Hi Steven,

    Can you make sure that the appointments have resources assigned to them of the resource type by which you group the control? For example, if you group by trucks, can in open the advanced form of some appointments and verify that they have a truck assigned to them?

    Kind regards,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brian
    Brian avatar
    68 posts
    Member since:
    Jun 2011

    Posted 11 Jan 2012 Link to this post

    Peter,

    Thank you for your reply.

    I am not sure what you mean when you say, "open the advanced form of some appointments....". What advanced form?

    You may be familiar with SQL Server Management Studio (SSMS). This is the tool that I use to verify data.

    As you can tell from my Test.aspx that I provided, my SelectCommand references a table called tblAppointments, and this table has several columns, one of them called TruckID. I can use SSMS to verify that every appointment has been assigned a truck ID.

    The aspx also has a ResourceType of "Trucks" and this resource references a data source called tblTrucks, which is a table that stores the TruckID of every truck. This is also verified by using SSMS. The tblTrucks table has truck IDs 1, 2, and 3. Every appointment in tblAppointments has a TruckID value of 1, 2, or 3. There are no blank truck IDs in tblAppointments. Does this information answer the question that you posted earlier?

    Thanks again,
    Steven
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 11 Jan 2012 Link to this post

    Hello Steven,

    Yes, this answers my question and it also rules out my initial assumption for the cause of the problem.

    Would you be able to prepare a sample project and send it to us via a support ticket so we can inspect it locally?

    Greetings,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  6. Brian
    Brian avatar
    68 posts
    Member since:
    Jun 2011

    Posted 11 Jan 2012 Link to this post

    Peter,

    Thank you for helping me to resolve this problem. By taking the time to prepare a sample project that you requested, I discovered that the data-type of the TruckID in table tblTrucks was a TinyInt, while the data-type of the TruckID in table tblAppointments was an Int. Although you can successfully match these 2 data-types in every other scenario (that I can think of), you apparently cannot match these 2 data-types within the ResourceType of a RadScheduler control. When you group a TinyInt against an Int, the scheduler control displays no data. So by making TruckID in both tables a TinyInt (or an Int), the scheduler would then display my grouped data. I suppose it's good practice to keep your primary and foreign keys the same data-type.

    Thanks for your help,
    Steven
  7. Karthik
    Karthik avatar
    19 posts
    Member since:
    Aug 2012

    Posted 21 Nov 2012 Link to this post

    I thought I will just share another issue and solution here for others as I had exactly the same issue. I had the foreign and primary keys in the resource type as a Guid and when I tried to group by it was not displaying the appointments, once I changed that to string the appointments appeared straight away.
  8. S
    S avatar
    1 posts
    Member since:
    Nov 2010

    Posted 05 Sep 2014 in reply to Karthik Link to this post

    Perfect. After some 10 hours battle, trying evenrything I could imagine, this issue was causing my problem as well. The resource table got ID as integer and the foreignfield was varchar. 

    Thanks a lot for sharing the issue and the solution. It would be great if Telerik warns for such issue in the description of the resourcetypes.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017