previous daynext daytoday
This is another application scenario demonstrating how you can manage different resources through Scheduler. In this instance you can book facilities for a variety of events.
In order to enable the resource grouping set the GroupBy property to the name of the resource, for example "Room". In addition, you can also group by date and resource - you need to add the "Date" keyword before the resource name. For example - GroupBy="Date,Room".
The direction of the grouping can be controlled with the GroupingDirection property.
<%@ Page Language="C#" AutoEventWireup="true" Inherits="Telerik.Web.Examples.Scheduler.ResourceGrouping.DefaultCS" CodeFile="DefaultCS.aspx.cs" %><%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %><%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %><%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %><%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %><%@ Register TagPrefix="sds" Namespace="Telerik.Web.SessionDS" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <qsf:HeadTag ID="Headtag1" runat="server" /> <style type="text/css"> #ConfiguratorPanel1 ul { list-style: none; padding: 7px 0; margin:0 auto; width: 600px; height: 24px; } #ConfiguratorPanel1 ul li { line-height: 24px; float:left; border-left: solid 1px #b1d8eb; padding-left: 11px; margin-left: 10px; height: 24px; } #ConfiguratorPanel1 .RadComboBox { vertical-align: middle; } </style></head><body class="BODY"> <form id="Form1" method="post" runat="server"> <qsf:Header ID="Header1" runat="server" NavigationLanguage="C#" /> <telerik:RadScriptManager runat="server" ID="RadScriptManager1" /> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" InitialDelayTime="500" /> <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" CssClass="exampleContainer"> <qsf:ConfiguratorPanel runat="server" ID="ConfiguratorPanel1" Expanded="true"> <ul> <li style="border: none"> <asp:CheckBox runat="server" Text="Group by room" Checked="true" AutoPostBack="true" ID="GroupByRoomCheckBox" OnCheckedChanged="GroupByRoomCheckBox_CheckedChanged" /> </li> <li> <asp:CheckBox runat="server" Text="Group by date" AutoPostBack="true" ID="GroupByDateCheckBox" OnCheckedChanged="GroupByDateCheckBox_CheckedChanged" /> </li> <li>Grouping direction: <telerik:RadComboBox runat="Server" ID="GroupingDirectionComboBox" Skin="Vista" OnSelectedIndexChanged="GroupingDirectionComboBox_SelectedIndexChanged" AutoPostBack="True"> <Items> <telerik:RadComboBoxItem Text="Horizontal" Value="Horizontal" /> <telerik:RadComboBoxItem Text="Vertical" Value="Vertical" /> </Items> </telerik:RadComboBox> </li> </ul> </qsf:ConfiguratorPanel> <telerik:RadScheduler runat="server" ID="RadScheduler1" GroupBy="Room" GroupingDirection="Horizontal" SelectedDate="2012-04-16" DayStartTime="08:00:00" DayEndTime="19:00:00" TimeZoneOffset="03:00:00" DataSourceID="EventsDataSource" DataKeyField="ID" DataSubjectField="Description" DataStartField="Start" DataEndField="End" DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID" SelectedView="WeekView" FirstDayOfWeek="Monday" LastDayOfWeek="Thursday" RowHeaderWidth="52px"> <AdvancedForm Modal="true" /> <ResourceTypes> <telerik:ResourceType KeyField="RoomID" Name="Room" TextField="Name" ForeignKeyField="RoomID" DataSourceID="RoomsDataSource" /> </ResourceTypes> <TimeSlotContextMenuSettings EnableDefault="true" /> <AppointmentContextMenuSettings EnableDefault="true" /> </telerik:RadScheduler> </telerik:RadAjaxPanel> <sds:SessionDataSource ID="EventsDataSource" runat="server" DisplayWarning="false" PrimaryKeyFields="ID" ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>" SelectCommand="SELECT [ID], [Description], [Start], [End], [RoomID], [RecurrenceRule], [RecurrenceParentID] FROM [Grouping_Events]" InsertCommand="INSERT INTO [Grouping_Events] ([Description], [Start], [End], [RoomID], [RecurrenceRule], [RecurrenceParentID]) VALUES (@Description, @Start, @End , @RoomID, @RecurrenceRule, @RecurrenceParentID)" UpdateCommand="UPDATE [Grouping_Events] SET [Description] = @Description, [Start] = @Start, [End] = @End, [RoomID] = @RoomID, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID WHERE (ID = @ID)" DeleteCommand="DELETE FROM [Grouping_Events] WHERE [ID] = @ID"> <DeleteParameters> <asp:Parameter Name="ID" Type="Int32" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="ID" Type="Int32" /> <asp:Parameter Name="Description" Type="String" /> <asp:Parameter Name="Start" Type="DateTime" /> <asp:Parameter Name="End" Type="DateTime" /> <asp:Parameter Name="RoomID" Type="Int32" /> <asp:Parameter Name="RecurrenceRule" Type="String" /> <asp:Parameter Name="RecurrenceParentID" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="Description" Type="String" /> <asp:Parameter Name="Start" Type="DateTime" /> <asp:Parameter Name="End" Type="DateTime" /> <asp:Parameter Name="RoomID" Type="Int32" /> <asp:Parameter Name="RecurrenceRule" Type="String" /> <asp:Parameter Name="RecurrenceParentID" Type="Int32" /> </InsertParameters> </sds:SessionDataSource> <sds:SessionDataSource ID="RoomsDataSource" runat="server" DisplayWarning="false" ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>" SelectCommand="SELECT [RoomID], [Name] FROM [Grouping_Rooms]"> </sds:SessionDataSource> <qsf:Footer runat="server" ID="Footer1" /> </form></body></html>
Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.
Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.
If you have any questions, do not hesitate to contact us at sales@telerik.com.