or
<
telerik:RadScheduler
ID
=
"schAbsences"
runat
=
"server"
HoursPanelTimeFormat
=
"HH:mm"
SelectedView
=
"TimelineView"
ShowViewTabs
=
"false"
ShowResourceHeaders
=
"true"
TimelineView-EnableExactTimeRendering
=
"true"
TimelineView-ShowDateHeaders
=
"true"
OnAppointmentDataBound
=
"schAbsences_AppointmentDataBound"
OnAppointmentDelete
=
"schAbsences_AppointmentDelete"
OnAppointmentUpdate
=
"schAbsences_AppointmentUpdate"
ColumnHeaderDateFormat
=
"h:mm"
FirstDayOfWeek
=
"Monday"
LastDayOfWeek
=
"Sunday"
ShowAllDayRow
=
"true"
ShowFooter
=
"true"
OverflowBehavior
=
"Expand"
OnNavigationComplete
=
"schAbsences_NavigationComplete"
>
<
TimelineView
NumberOfSlots
=
"24"
SlotDuration
=
"01:00:00"
TimeLabelSpan
=
"1"
ColumnHeaderDateFormat
=
"HH:mm tt"
/>
</
telerik:RadScheduler
>
ResourceType rt = new ResourceType();
rt.Name = "Resources";
rt.ForeignKeyField = "ResourceId";
rt.KeyField = "Id";
rt.TextField = "FullName";
List<
Entities.Resource
> blapp = new List<
Entities.Resource
>();
blapp.AddRange(DBManager.GetExistingResources());
Entities.Resource r = new Entities.Resource();
r.firstName = "Inte";
r.lastName = "tillsatt";
r.Id = 0;
blapp.Insert(0, r);
rt.DataSource = blapp;
schAbsences.ResourceTypes.Add(rt);
DateTime startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
schAbsences.SelectedDate = startTime;
schAbsences.TimelineView.GroupBy = "Resources";
schAbsences.TimelineView.GroupingDirection = GroupingDirection.Vertical;
protected void schAbsences_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
{
String type = e.Appointment.Attributes["appointmentType"];
if (type.Equals("Absence"))
{
//Do update (use Attributes)
int origRsId = int.Parse(e.Appointment.Resources[0].Key.ToString());
}
else
{
int origResId = int.Parse(e.Appointment.Resources[0].Key.ToString());
int newResId = int.Parse(e.ModifiedAppointment.Resources[0].Key.ToString());
int appointmentId=int.Parse(e.Appointment.ID.ToString());
DBManager.UpdateMovedPlacementCompetence(appointmentId, newResId);
e.Cancel = true;
}
List<
BDEvent
> list = DBManager.GetAllAbsencesAsEvents();
list.AddRange(DBManager.GetAllPlacementCompetences());
schAbsences.DataSource = list;
}
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"col1"
HeaderText
=
"Col 1"
UniqueName
=
"mytxt"
/>
<
telerik:GridDropDownColumn
DataField
=
"col2"
UniqueName
=
"mydd"
DropDownControlType
=
"RadComboBox"
HeaderText
=
"Col 2"
/>
</
Columns
>
if
(e.Item
is
GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
DataRowView row = (DataRowView)e.Item.DataItem;
item[
"mydd"
].Text = row[
"col2"
].ToString();
}
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem item = (GridEditableItem)e.Item;
//Controls has one control:
//RadTextBox = (RadTextBox)item["mytxt"].Controls[0];
//Controls is empty:
//RadComboBox com = (RadComboBox)item["mydd"].Controls[0];
}
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem item = (GridEditableItem)e.Item;
RadComboBox com = (RadComboBox)item[
"mydd"
].Controls[0];
com.Items.Add(
new
RadComboxItem(
"a"
,
"a"
));
com.Items.Add(
new
RadComboxItem(
"b"
,
"b"
));
}