I am trying to put together the resource availability in the RadScheduler and I am having some trouble. Basically, I used the resource availability demo code as my base and changed some of the parameters to fit my application. Also, I do not need the "Room" availability to be considered in my argument, so I removed it from the resources. However, when I run my application, I receive the following error:
Server Error in '/RadTest1' Application.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Source File: C:\WebSites\RadTest1\Schedule.aspx.vb Line: 18
Here is the code I am using. Can someone help me out?
Thanks.
Server Error in '/RadTest1' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 16:
Line 17: Dim assignedTo As Label = DirectCast(e.Container.FindControl("AssignedTo"), Label)
Line 18: assignedTo.Text = "Held by: " + user.Text
Line 19: End Sub
Line 20:
|
Source File: C:\WebSites\RadTest1\Schedule.aspx.vb Line: 18
Here is the code I am using. Can someone help me out?
Thanks.
<%@ Page Language="VB" AutoEventWireup="true" Inherits="Telerik.Web.Examples.Scheduler.ResourceAvailability.Schedule"
CodeFile="Schedule.aspx.vb" %>
<%--<%@ 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
id
=
"Head1"
runat
=
"server"
>
<
title
></
title
>
<
link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"userStyles.css"
/>
</
head
>
<
body
class
=
"BODY"
>
<
form
id
=
"Form1"
method
=
"post"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager2"
runat
=
"server"
>
<
Scripts
>
<%--Needed for JavaScript IntelliSense in VS2010--%>
<%--For VS2008 replace RadScriptManager with ScriptManager--%>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadScheduler1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadScheduler1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
runat
=
"server"
ID
=
"RadAjaxLoadingPanel1"
/>
<
script
type
=
"text/javascript"
>
/* Helper functions */
/// <
summary
>
/// Returns the appointments in the specified period filtered by the specified resource.
/// </
summary
>
/// <
param
name
=
"scheduler"
>
/// RadScheduler's client-side object
/// </
param
>
/// <
param
name
=
"start"
type
=
"Date"
>
/// The start of the period
/// </
param
>
/// <
param
name
=
"end"
type
=
"Date"
>
/// The end of the period
/// </
param
>
/// <
param
name
=
"resource"
>
/// The resource (room or user) to filter by
/// </
param
>
/// <
param
name
=
"appointment"
>
/// The current appointment
/// </
param
>
function getAppointmentsInRangeByResource(scheduler, start, end, resource, appointment) {
//Get all appointments within the specified time period
var result = scheduler.get_appointments().getAppointmentsInRange(start, end);
//If specified remove the appointment from the appointment list
if (appointment)
result.remove(appointment);
//Filter the appointments based on the resource
return result.findByResource(resource);
}
/// <
summary
>
/// Checks if the user associated with the specified appointment has another
/// appointment in the specified time period
/// </
sumary
>
/// <
param
name
=
"scheduler"
>
/// RadScheduler's client-side object
/// </
param
>
/// <
param
name
=
"start"
type
=
"Date"
>
/// The start of the period
/// </
param
>
/// <
param
name
=
"end"
type
=
"Date"
>
/// The end of the period
/// </
param
>
/// <
param
name
=
"appointment"
>
/// The current appointment
/// </
param
>
function isUserOccupied(scheduler, start, end, appointment) {
//get the "User" resource associated with the appointment
var currentUser = appointment.get_resources().getResourcesByType("User").getResource(0);
//get all appointments in this period which are associated with this resource
var appointmentsForThisUser = getAppointmentsInRangeByResource(scheduler, start, end, currentUser, appointment);
//if the list of appointments is not empty the user has other appointments besides the specified in this time period
return appointmentsForThisUser.get_count() > 0;
}
/// <
summary
>
/// Checks if there are other appointments within the specified time slot
/// </
sumary
>
/// <
param
name
=
"scheduler"
>
/// RadScheduler's client-side object
/// </
param
>
/// <
param
name
=
"start"
type
=
"Date"
>
/// The start of the period
/// </
param
>
/// <
param
name
=
"end"
type
=
"Date"
>
/// The end of the period
/// </
param
>
/// <
param
name
=
"slot"
>
/// The time slot to check
/// </
param
>
function isRoomOccupied(scheduler, start, end, slot, appointment) {
//get the "Room" resource associated with the time slot
var currentRoom = slot.get_resource();
//get all appointments for this "room" in the specified period
var appointmentsForThisRoom = getAppointmentsInRangeByResource(scheduler, start, end, currentRoom, appointment);
//if the list of appointments is not empty there are other appointments in this slot
return appointmentsForThisRoom.get_count() > 0;
}
/// <
summary
>
/// Checks if the specified time slot is occupied and warns to prevent appointment rescheduling.
/// Called by the resizeEnd and moveEnd client-side event handlers.
/// </
sumary
>
function warnIfOccupied(start, end, sender, args) {
var slot = args.get_targetSlot();
var appointment = args.get_appointment();
if (isUserOccupied(sender, start, end, appointment)) {
alert("This user is occupied in this time period.");
args.set_cancel(true);
}
else if (isRoomOccupied(sender, start, end, slot, appointment)) {
alert("This room is not available in this time period.");
args.set_cancel(true);
}
appointment.get_element().style.border = "";
}
/// <
summary
>
/// Checks if the specified time slot is occupied and visually shows it to the user.
/// Called by the resizeing and moving client-side event handlers.
/// </
sumary
>
function highlightIfOccupied(start, end, sender, args) {
var appointment = args.get_appointment();
var slot = args.get_targetSlot();
if (isUserOccupied(sender, start, end, appointment) || isRoomOccupied(sender, start, end, slot, appointment)) {
appointment.get_element().style.border = "1px solid red";
return;
}
appointment.get_element().style.border = "";
}
function onAppointmentResizing(sender, args) {
var start = args.get_appointment().get_start();
var end = args.get_targetSlot().get_endTime();
highlightIfOccupied(start, end, sender, args);
}
function onAppointmentResizeEnd(sender, args) {
var start = args.get_appointment().get_start();
var end = args.get_targetSlot().get_endTime();
warnIfOccupied(start, end, sender, args);
}
function onAppointmentMoving(sender, args) {
var start = args.get_targetSlot().get_startTime();
var end = new Date(start.getTime() + args.get_appointment().get_duration());
highlightIfOccupied(start, end, sender, args);
}
function onAppointmentMoveEnd(sender, args) {
var start = args.get_targetSlot().get_startTime();
var end = new Date(start.getTime() + args.get_appointment().get_duration());
warnIfOccupied(start, end, sender, args);
}
function onAppointmentInserting(sender, args) {
var slot = args.get_targetSlot();
var start = slot.get_startTime();
var end = slot.get_endTime();
if (isRoomOccupied(sender, start, end, slot)) {
alert("This room is not available in this time period.");
args.set_cancel(true);
}
}
</
script
>
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
AppendDataBoundItems
=
"True"
AutoPostBack
=
"True"
DataSourceID
=
"SqlDataSource2"
DataTextField
=
"FirstName"
DataValueField
=
"EmployeeID"
Skin
=
"WebBlue"
>
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Selected
=
"True"
Text
=
"Whole Office"
Value
=
"0"
/>
</
Items
>
</
telerik:RadComboBox
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"
DeleteCommand="DELETE FROM [Appointments] WHERE [AppointmentID] = @AppointmentID"
InsertCommand="INSERT INTO [Appointments] ([StartTime], [EndTime], [PatientID], [Description], [RecParent], [RecData], [EmployeeID]) VALUES (@StartTime, @EndTime, @PatientID, @Description, @RecParent, @RecData, @EmployeeID)"
SelectCommand="IF @EmployeeID = 0 BEGIN SELECT * FROM [Appointments] END ELSE BEGIN SELECT * FROM [Appointments] WHERE ([EmployeeID] = @EmployeeID) END"
UpdateCommand="UPDATE [Appointments] SET [StartTime] = @StartTime, [EndTime] = @EndTime, [PatientID] = @PatientID, [Description] = @Description, [RecParent] = @RecParent, [RecData] = @RecData, [EmployeeID] = @EmployeeID WHERE [AppointmentID] = @AppointmentID">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"AppointmentID"
Type
=
"Int32"
/>
</
DeleteParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"StartTime"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"EndTime"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"PatientID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"Description"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"RecParent"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"RecData"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"EmployeeID"
Type
=
"Int32"
/>
</
InsertParameters
>
<
SelectParameters
>
<
asp:ControlParameter
ControlID
=
"RadComboBox1"
Name
=
"EmployeeID"
PropertyName
=
"SelectedValue"
Type
=
"Int32"
/>
</
SelectParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"StartTime"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"EndTime"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"PatientID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"Description"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"RecParent"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"RecData"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"EmployeeID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"AppointmentID"
Type
=
"Int32"
/>
</
UpdateParameters
>
</
asp:SqlDataSource
>
<
telerik:RadScheduler
runat
=
"server"
ID
=
"RadScheduler1"
SelectedDate
=
"2007-03-30"
DataSourceID
=
"SqlDataSource1"
DataKeyField
=
"AppointmentID"
DataSubjectField
=
"PatientID"
DataStartField
=
"StartTime"
DataEndField
=
"EndTime"
TimeZoneOffset
=
"03:00:00"
OnAppointmentCreated
=
"RadScheduler1_AppointmentCreated"
DataDescriptionField
=
"Description"
DataRecurrenceField
=
"RecData"
DataRecurrenceParentKeyField
=
"RecParent"
EnableDescriptionField
=
"True"
Skin
=
"WebBlue"
Height
=
"1500px"
MinutesPerRow
=
"15"
SelectedView
=
"WeekView"
AdvancedForm-Modal
=
"True"
AppointmentContextMenuSettings-EnableEmbeddedSkins
=
"True"
StartInsertingInAdvancedForm
=
"True"
TimelineView-ReadOnly
=
"False"
>
<
TimelineView
UserSelectable
=
"false"
/>
<
WeekView
UserSelectable
=
"true"
/>
<
MonthView
UserSelectable
=
"true"
/>
<
DayView
UserSelectable
=
"true"
/>
<
ResourceTypes
>
<%--<
telerik:ResourceType
KeyField
=
"ID"
Name
=
"Room"
TextField
=
"RoomName"
ForeignKeyField
=
"RoomID"
DataSourceID
=
"RoomsDataSource"
/>--%>
<
telerik:ResourceType
KeyField
=
"EmployeeID"
Name
=
"User"
TextField
=
"FirstName"
ForeignKeyField
=
"AppointmentID"
DataSourceID
=
"SqlDataSource2"
/>
</
ResourceTypes
>
<
ResourceStyles
>
<
telerik:ResourceStyleMapping
Type
=
"User"
Text
=
"Alex"
ApplyCssClass
=
"rsCategoryBlue"
/>
<
telerik:ResourceStyleMapping
Type
=
"User"
Text
=
"Bob"
ApplyCssClass
=
"rsCategoryOrange"
/>
<
telerik:ResourceStyleMapping
Type
=
"User"
Text
=
"Charlie"
ApplyCssClass
=
"rsCategoryGreen"
/>
</
ResourceStyles
>
<
AppointmentContextMenus
>
<
telerik:RadSchedulerContextMenu
runat
=
"server"
ID
=
"ContextMenu1"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Edit"
Value
=
"CommandEdit"
/>
<
telerik:RadMenuItem
IsSeparator
=
"True"
/>
<%--<
telerik:RadMenuItem
Text
=
"Categorize"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Development"
Value
=
"1"
/>
<
telerik:RadMenuItem
Text
=
"Marketing"
Value
=
"2"
/>
<
telerik:RadMenuItem
Text
=
"Personal"
Value
=
"3"
/>
<
telerik:RadMenuItem
Text
=
"Work"
Value
=
"4"
/>
</
Items
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
IsSeparator
=
"True"
/>--%>
<
telerik:RadMenuItem
Text
=
"Delete"
Value
=
"CommandDelete"
/>
</
Items
>
</
telerik:RadSchedulerContextMenu
>
</
AppointmentContextMenus
>
<
AppointmentTemplate
>
<%# Eval("Subject") %>
<
br
/>
<
asp:Label
runat
=
"server"
ID
=
"AssignedTo"
/>
</
AppointmentTemplate
>
<
InlineInsertTemplate
>
<
div
id
=
"InlineInsertTemplate"
>
<
asp:TextBox
ID
=
"TitleTextBox2"
runat
=
"server"
Text='<%# Bind("Subject") %>' Width="90%"
TextMode="MultiLine" Height="20px"></
asp:TextBox
>
<
asp:LinkButton
ID
=
"InsertButton2"
runat
=
"server"
CommandName
=
"Insert"
>
<
asp:Image
runat
=
"server"
ID
=
"insertImage2"
ImageUrl
=
"Images/ok.gif"
AlternateText
=
"update"
/>
</
asp:LinkButton
>
<
asp:LinkButton
ID
=
"InsertCancelButton2"
runat
=
"server"
CausesValidation
=
"False"
CommandName
=
"Cancel"
>
<
asp:Image
runat
=
"server"
ID
=
"Image32"
ImageUrl
=
"Images/cancel.gif"
AlternateText
=
"cancel"
/>
</
asp:LinkButton
>
<%--<
div
class
=
"inline-label"
>
Color code:</
div
>
<
asp:RadioButtonList
runat
=
"server"
ID
=
"AppointmentTypeRadioButtonList"
DataValueField
=
"ID"
CssClass
=
"AppointmentTypeSelectorTable"
DataSourceID
=
"AppointmentTypesDataSource"
SelectedValue='<%# Bind("AppointmentTypeID") %>' DataTextField="Keyword" RepeatDirection="Horizontal"
DataTextFormatString="<
span
class
=
'AppointmentTypeSelector rsAptType_{0}'
onclick
=
'onAppointmentTypeSelectorClick'
></
span
>">
</
asp:RadioButtonList
>--%>
<
asp:LinkButton
ID
=
"InsertMoreButton2"
runat
=
"server"
CommandName
=
"More"
CssClass
=
"rsAdvancedEditLink"
>Matt Advanced</
asp:LinkButton
>
</
div
>
<%--<
asp:TextBox
runat
=
"server"
ID
=
"SubjectTextBox"
Text='<%# Bind("Subject") %>' Width="99%"></
asp:TextBox
>
<
div
class
=
"UserToolbox"
>
User:
<
telerik:RadComboBox
runat
=
"server"
ID
=
"UsersComboBox"
DataTextField
=
"Text"
DataValueField
=
"Key"
Width
=
"80px"
Skin
=
"Office2007"
SelectedValue='<%# Bind("EmployeeID") %>' DataSource="<%# GetAvailableUsers(Container) %>">
</
telerik:RadComboBox
>
<
asp:LinkButton
runat
=
"server"
ID
=
"InsertLinkButton"
CommandName
=
"Insert"
Text
=
"Insert"
></
asp:LinkButton
>
<
asp:LinkButton
runat
=
"server"
ID
=
"CancelLinkButton"
CommandName
=
"Cancel"
Text
=
"Cancel"
></
asp:LinkButton
>
</
div
>--%>
</
InlineInsertTemplate
>
<
InlineEditTemplate
>
<
div
id
=
"InlineEditTemplate"
>
<
asp:TextBox
ID
=
"TitleTextBox"
runat
=
"server"
Text='<%# Bind("Subject") %>' Width="90%"
TextMode="MultiLine" Height="20px"></
asp:TextBox
>
<
asp:LinkButton
ID
=
"InsertButton"
runat
=
"server"
CommandName
=
"Update"
>
<
asp:Image
runat
=
"server"
ID
=
"insertImage"
ImageUrl
=
"Images/ok.gif"
AlternateText
=
"update"
/>
</
asp:LinkButton
>
<
asp:LinkButton
ID
=
"InsertCancelButton"
runat
=
"server"
CausesValidation
=
"False"
CommandName
=
"Cancel"
>
<
asp:Image
runat
=
"server"
ID
=
"Image3"
ImageUrl
=
"Images/cancel.gif"
AlternateText
=
"cancel"
/>
</
asp:LinkButton
>
<%--<
div
class
=
"inline-label"
>
Color code:</
div
>
<
asp:RadioButtonList
runat
=
"server"
ID
=
"AppointmentTypeRadioButtonList"
DataValueField
=
"ID"
CssClass
=
"AppointmentTypeSelectorTable"
DataSourceID
=
"AppointmentTypesDataSource"
SelectedValue='<%# Bind("AppointmentTypeID") %>' DataTextField="Keyword" RepeatDirection="Horizontal"
DataTextFormatString="<
span
class
=
'AppointmentTypeSelector rsAptType_{0}'
onclick
=
'onAppointmentTypeSelectorClick'
></
span
>">
</
asp:RadioButtonList
>--%>
<
asp:LinkButton
ID
=
"InsertMoreButton"
runat
=
"server"
CommandName
=
"More"
CssClass
=
"rsAdvancedEditLink"
>Matt Advanced</
asp:LinkButton
>
</
div
>
<%--<
asp:TextBox
runat
=
"server"
ID
=
"SubjectTextBox"
Text='<%# Bind("Subject") %>' Width="99%"></
asp:TextBox
>
<
div
class
=
"UserToolbox"
>
User:
<
telerik:RadComboBox
runat
=
"server"
ID
=
"UsersComboBox"
DataTextField
=
"Text"
DataValueField
=
"Key"
Width
=
"80px"
Skin
=
"Office2007"
SelectedValue='<%# Bind("EmployeeID") %>' DataSource="<%# GetAvailableUsers(Container) %>">
</
telerik:RadComboBox
>
<
asp:LinkButton
runat
=
"server"
ID
=
"UpdateLinkButton"
CommandName
=
"Update"
Text
=
"Update"
></
asp:LinkButton
>
<
asp:LinkButton
runat
=
"server"
ID
=
"CancelLinkButton"
CommandName
=
"Cancel"
Text
=
"Cancel"
></
asp:LinkButton
>
</
div
>--%>
</
InlineEditTemplate
>
<
TimeSlotContextMenuSettings
EnableDefault
=
"true"
/>
<
AppointmentContextMenuSettings
EnableDefault
=
"true"
/>
</
telerik:RadScheduler
>
<
asp:SqlDataSource
ID
=
"SqlDataSource2"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"
DeleteCommand="DELETE FROM [Employees] WHERE [EmployeeID] = @EmployeeID" InsertCommand="INSERT INTO [Employees] ([PracticeID], [FirstName], [LastName], [SSN], [Street], [City], [State], [Zip], [HomePhone], [CellPhone], [Email]) VALUES (@PracticeID, @FirstName, @LastName, @SSN, @Street, @City, @State, @Zip, @HomePhone, @CellPhone, @Email)"
SelectCommand="SELECT * FROM [Employees]" UpdateCommand="UPDATE [Employees] SET [PracticeID] = @PracticeID, [FirstName] = @FirstName, [LastName] = @LastName, [SSN] = @SSN, [Street] = @Street, [City] = @City, [State] = @State, [Zip] = @Zip, [HomePhone] = @HomePhone, [CellPhone] = @CellPhone, [Email] = @Email WHERE [EmployeeID] = @EmployeeID">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"EmployeeID"
Type
=
"Int32"
/>
</
DeleteParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"PracticeID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"FirstName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"LastName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"SSN"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Street"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"City"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"State"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Zip"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"HomePhone"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"CellPhone"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Email"
Type
=
"String"
/>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"PracticeID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"FirstName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"LastName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"SSN"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Street"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"City"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"State"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Zip"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"HomePhone"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"CellPhone"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Email"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"EmployeeID"
Type
=
"Int32"
/>
</
UpdateParameters
>
</
asp:SqlDataSource
>
</
form
>
</
body
>
</
html
>
Imports
System
Imports
System.Collections
Imports
System.Collections.Generic
Imports
System.Web.UI
Imports
System.Web.UI.WebControls
Imports
Telerik.Web.UI
Namespace
Telerik.Web.Examples.Scheduler.ResourceAvailability
Partial
Public
Class
Schedule
Inherits
Page
Private
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
End
Sub
Protected
Sub
RadScheduler1_AppointmentCreated(
ByVal
sender
As
Object
,
ByVal
e
As
AppointmentCreatedEventArgs)
Dim
user
As
Resource = e.Appointment.Resources.GetResourceByType(
"User"
)
Dim
assignedTo
As
Label =
DirectCast
(e.Container.FindControl(
"AssignedTo"
), Label)
assignedTo.Text =
"Held by: "
+ user.Text
End
Sub
Protected
Function
GetAvailableUsers(
ByVal
container
As
Control)
As
IEnumerable
Dim
appointment
As
Appointment = (
DirectCast
(container, SchedulerFormContainer)).Appointment
Dim
availableUsers
As
New
List(Of Resource)(RadScheduler1.Resources.GetResourcesByType(
"User"
))
For
Each
appointmentInRange
As
Appointment
In
RadScheduler1.Appointments.GetAppointmentsInRange(appointment.Start, appointment.[
End
])
If
appointmentInRange
Is
appointment
Then
Continue
For
End
If
For
Each
occupiedUser
As
Resource
In
appointmentInRange.Resources.GetResourcesByType(
"User"
)
availableUsers.Remove(occupiedUser)
Next
Next
Return
availableUsers
End
Function
End
Class
End
Namespace