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

Group by Resources in a RadSchedular

1 Answer 113 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Vuyiswa
Top achievements
Rank 2
Vuyiswa asked on 23 Jun 2010, 08:29 AM
Good Day all

I have  a the Following query

Declare @NumberOfSessions INT
set @NumberOfSessions = (select [Sessions] from dbo.TBL_TTBL)

SELECT   ID, Dy,  Sess,[Code],[Description],Description + '  Venue:'+ CAST(Venue AS VARCHAR) +' Student:'+ CAST(Students AS VARCHAR) +' StaffTerm:'+CAST(StaffTerm AS VARCHAR) + ' Term:'+ CAST(Term AS VARCHAR)  AS [SUBJECTS],Abrev,[Type],Number,
GrpName,GrpNumber,Duration,[Students],
[Venue],Capacity,
[Staff],[ModlID],[Term]
,[StaffTerm]
,CAST(STARTDATE AS DATETIME) as [STARTDATE], CAST(ENDDATE AS DATETIME) AS [ENDDATE],[Length],CAST(@NumberOfSessions AS INT) as [Number_of_Sessions]
FROM
 final_Timetable
group by dy,ID,Sess,[Code],[Description],Description,Abrev,[Type],Number,
GrpName,GrpNumber,Duration,[Students],
[Venue],Capacity,
[Staff],[ModlID],[Term]
,[StaffTerm],[STARTDATE],[ENDDATE],[Length]
order by dy,sess


i am binding this Data to the RadSchedular and the definition of my markup looks like this

  <telerik:RadScheduler ID="RadScheduler1" ColumnWidth="200px" RowHeaderWidth="200px" DayView-GroupingDirection="Vertical" RowHeaderHeight="400px"  runat="server" DataSourceID="SqlDataSource2"
            DataEndField="ENDDATE" DataKeyField="ID"  Skin="Telerik" Height="300px" Width="1600px" DataSubjectField="SUBJECTS"  DataStartField="STARTDATE" AllowDelete="False" AllowEdit="False" AllowInsert="False"   DayEndTime="20:00:00" DisplayRecurrenceActionDialogOnMove="True" OverflowBehavior="Expand" SelectedView="MonthView"  OnDataBound="RadScheduler1_DataBound" OnAppointmentCreated="RadScheduler1_AppointmentCreated" CssClass="ConfigurationPanel1" OnTimeSlotCreated="RadScheduler1_TimeSlotCreated" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound">
            <MultiDayView UserSelectable="True"   ReadOnly="True" GroupBy="Venue" GroupingDirection="Vertical" />
            <DayView GroupingDirection="Vertical" />
            <Localization AdvancedDay="DY" />
           <ResourceTypes>
            <telerik:ResourceType KeyField="Venue" Name="Venue" TextField="Venue" ForeignKeyField="Venue"
            DataSourceID="SqlDataSource2" />
            </ResourceTypes>
        </telerik:RadScheduler>
       
and my Datasource Controls is using a Sp and its defined like this

        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="Data Source=(local);Initial Catalog=oDirectv3;Persist Security Info=True;User ID=o;Password=abacus"
            SelectCommand="sp_Timetable_View" DeleteCommand="sp_Timetable_View" ProviderName="<%$ ConnectionStrings:DBConnectionString.ProviderName %>" DeleteCommandType="StoredProcedure" SelectCommandType="StoredProcedure" OnSelecting="SqlDataSource2_Selecting">
            <SelectParameters>
                <asp:SessionParameter DefaultValue="" Name="selectionType" SessionField="viewOptions"
                    Type="String" />
                <asp:SessionParameter DefaultValue="" Name="selectedItems" SessionField="selectedItems"
                    Type="String" />
                <asp:SessionParameter DefaultValue="" Name="selectedTerms" SessionField="selectedTerms"
                    Type="String" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="selectionType" Type="String" />
                <asp:Parameter Name="selectedItems" Type="String" />
                <asp:Parameter Name="selectedTerms" Type="String" />
            </DeleteParameters>
        </asp:SqlDataSource>

The Results from this datasource has all the fields i need to bind the Schedular. i have looked at the example in telerik site http://demos.telerik.com/aspnet-ajax/scheduler/examples/timelineview/defaultcs.aspx

and here they have a different Datasource Control for Groupby, i am not sure why, but as you can see i have used the same DatasourceControl to Bind the Group by.

Now my problem is that the Schedular does not show the Group by Resource as in the Example. I tried to use a second SQlDatasource for a group by sake, and i get an error that is not descriptive "Object not set for an instance of a Class"

What is it i should put in mind while Doing the Group by

Thanks
 
 

1 Answer, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 25 Jun 2010, 02:00 PM
Hi Vuyiswa Maseko,

I've created a sample project to show you how to get resources and bind the RadScheduler to the same DataSource.

Find the code in the attached .zip file.

Hope this helps.

Best wishes,
Veronica Milcheva
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Scheduler
Asked by
Vuyiswa
Top achievements
Rank 2
Answers by
Veronica
Telerik team
Share this question
or