Hello,
I've a rad scheduler with a customized template for the edit item. I've my own controls in the template and it is working fine. But when i double click an empty cell i just get prompted to enter the title of the appoinment. Can i custom that template too? I want another dropdown it, say category.
Thank you.
11 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 13 Jan 2010, 01:16 PM
Hello Ragavendra,
You can use InlineInsertTemplate/AdvancedInsertTemplate templates to customize the insert form in RadScheduler. Checkout the following links for more information.
Documentation
Demo
-Shinu.
You can use InlineInsertTemplate/AdvancedInsertTemplate templates to customize the insert form in RadScheduler. Checkout the following links for more information.
Documentation
Demo
-Shinu.
0
NLV
Top achievements
Rank 1
answered on 13 Jan 2010, 04:23 PM
Thank you very much.
0
NLV
Top achievements
Rank 1
answered on 18 Jan 2010, 03:00 PM
Hello,
I followed the link you gave. I've customized the insert template. I've a textbox, Radcombobox and two buttons add & cancel. I've initialized the controls in the form created event. But how can i get the value seleceted in the dropdown list in the AppointmentInsert event?
Here is my code -
FormCreated Event
How to get the combox value in AppointmentInsert event?
Thank you.
NLV
I followed the link you gave. I've customized the insert template. I've a textbox, Radcombobox and two buttons add & cancel. I've initialized the controls in the form created event. But how can i get the value seleceted in the dropdown list in the AppointmentInsert event?
Here is my code -
<InlineInsertTemplate> |
<div id="InlineInsertTemplate" class="rsCustomAppointmentContainer"> |
<asp:Label ID="lblTitle" runat="server" Text="Add New Appointment"></asp:Label> |
<hr /> |
<table cellspacing="5"> |
<tr> |
<td><asp:Label ID="lblSubject" runat="server" Text="Title"></asp:Label> </td> |
<td><Telerik:RadTextBox ID="txtInlineInsertTitle" runat="server" Width="150px" Text='<%# Bind("Subject") %>'></Telerik:RadTextBox></td> |
</tr> |
<tr> |
<td><asp:Label ID="lblList" runat="server" Text="Source List"></asp:Label> </td> |
<td><Telerik:RadComboBox ID="cbxInlineInsertLists" runat="server"></Telerik:RadComboBox></td> |
</tr> |
<tr> |
<td align="center"> |
<asp:Button ID="btnInlineInsert" runat="server" Text="Add" CommandName="Insert" /> |
|
<asp:Button ID="btnInlineCancel" runat="server" Text="Cancel" CommandName="Cancel" /> |
</td> |
</tr> |
</table> |
</div> |
</InlineInsertTemplate> |
FormCreated Event
void radschedulerMain_FormCreated(object sender, SchedulerFormCreatedEventArgs e) |
{ |
if (e.Container.Mode == SchedulerFormMode.Insert) |
{ |
RadComboBox rcbxLists = (RadComboBox)e.Container.FindControl("cbxInlineInsertLists"); |
rcbxLists.Items.Clear(); |
dtListSettings = oAllSett.objListSettings.ListsTable; |
foreach (DataRow dRow in dtListSettings.Rows) |
{ |
rcbxLists.Items.Add(new RadComboBoxItem(Convert.ToString(dRow["ListName"]), Convert.ToString(dRow["ListGUID"]))); |
} |
} |
//throw new Exception("The method or operation is not implemented."); |
} |
How to get the combox value in AppointmentInsert event?
Thank you.
NLV
0
Hello Raghavendra,
You can attach on SelectedIndexChanged and store the selected value in ViewState, HiddenField or Session. For example:
]Best wishes,
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
You can attach on SelectedIndexChanged and store the selected value in ViewState, HiddenField or Session. For example:
protected
void
RadScheduler1_FormCreated(
object
sender, SchedulerFormCreatedEventArgs e)
{
RadComboBox rcbxLists = (RadComboBox)e.Container.FindControl(
"cbxInlineInsertLists"
);
rcbxLists.SelectedIndexChanged +=
new
RadComboBoxSelectedIndexChangedEventHandler(rcbxLists_SelectedIndexChanged);
}
void
rcbxLists_SelectedIndexChanged(
object
o, RadComboBoxSelectedIndexChangedEventArgs e)
{
ViewState[
"selectedValue"
]=e.Value;
}
]Best wishes,
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
NLV
Top achievements
Rank 1
answered on 19 Jan 2010, 05:05 AM
Hi Peter,
Now i've the following code.
But i'm not getting the subject from "e.Container.Appointment.Subject". I'm always getting it as empty. Any ideas?
Thank you.
NLV
Now i've the following code.
<InlineInsertTemplate> |
<div id="InlineInsertTemplate" class="rsCustomAppointmentContainer"> |
<asp:Label ID="lblTitle" runat="server" Text="Add New Appointment"></asp:Label> |
<hr /> |
<table cellspacing="5" width="400px"> |
<tr> |
<td><asp:Label ID="lblSubject" runat="server" Text="Title"></asp:Label> </td> |
<td><Telerik:RadTextBox ID="txtInlineInsertTitle" runat="server" Width="150px" Text='<%# Bind("Subject") %>'></Telerik:RadTextBox></td> |
</tr> |
<tr> |
<td><asp:Label ID="lblList" runat="server" Text="Source List"></asp:Label> </td> |
<td><Telerik:RadComboBox ID="cbxInlineInsertLists" runat="server"></Telerik:RadComboBox></td> |
</tr> |
<tr> |
<td align="center"> |
<asp:Button ID="btnInlineInsert" runat="server" Text="Add" CommandName="inlineInsert" ValidationGroup="grpInlineInsert" /> |
|
<asp:Button ID="btnInlineCancel" runat="server" Text="Cancel" CommandName="inlineCancel" /> |
</td> |
</tr> |
<tr> |
<td colspan="2"> |
<asp:RequiredFieldValidator ID="rfvTitle" runat="server" Display="dynamic" ControlToValidate="txtInlineInsertTitle" Text="Title cannot be empty" ValidationGroup="grpInlineInsert" /> |
</td> |
</tr> |
</table> |
</div> |
</InlineInsertTemplate> |
void radschedulerMain_AppointmentCommand(object sender, AppointmentCommandEventArgs e) |
{ |
if(e.CommandName.Equals("inlineInsert", StringComparison.InvariantCultureIgnoreCase)) |
{ |
AppointmentInlineInsert(e.Container.Appointment); |
} |
else if (e.CommandName.Equals("inlineCancel", StringComparison.InvariantCultureIgnoreCase)) |
{ |
return; |
} |
//throw new Exception("The method or operation is not implemented."); |
} |
But i'm not getting the subject from "e.Container.Appointment.Subject". I'm always getting it as empty. Any ideas?
Thank you.
NLV
0
Hi Raghavendra,
The command names should be 'insert' and 'cancel':
All the best,
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
The command names should be 'insert' and 'cancel':
<
td
align
=
"center"
>
<
asp:Button
ID
=
"btnInlineInsert"
runat
=
"server"
Text
=
"Add"
CommandName
=
"Insert"
ValidationGroup
=
"grpInlineInsert"
/>
<
asp:Button
ID
=
"btnInlineCancel"
runat
=
"server"
Text
=
"Cancel"
CommandName
=
"Cancel"
/>
</
td
>
All the best,
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
NLV
Top achievements
Rank 1
answered on 20 Jan 2010, 09:48 AM
Hello Peter,
Thanks for your reply. Initially i used it as Insert and Cancel. But i'm going to modify all the templates - advanced insert, inline edit and advanced edit templates. Now for insert, it works fine. But for inline edit and advance edit, how can i load the values into the custom controls i've added in the template?
For ex, if i've a dropdownlist in the insert template and i get the value from it while inserting an appointment. Now if i double click the appointment and open it for editing, how can i load back the selected value of the dropdownlist into it?
Thank you.
NLV.
Thanks for your reply. Initially i used it as Insert and Cancel. But i'm going to modify all the templates - advanced insert, inline edit and advanced edit templates. Now for insert, it works fine. But for inline edit and advance edit, how can i load the values into the custom controls i've added in the template?
For ex, if i've a dropdownlist in the insert template and i get the value from it while inserting an appointment. Now if i double click the appointment and open it for editing, how can i load back the selected value of the dropdownlist into it?
Thank you.
NLV.
0
Hello Raghavendra,
Please, refer to the Using Templates demo.
Greetings,
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Please, refer to the Using Templates demo.
Greetings,
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
ARES
Top achievements
Rank 1
answered on 29 Apr 2013, 07:45 AM
Hi I have a major problem.
I initiate a RadSchedular by code
I set the template also by code. When I first load the page, and bind the data, the appointments display perfectly (dataset1).
When I query another dataset(dataset2) and bind the appointment template does not refresh, although the resources are displayed correctly.
If I go back to the first dataset (dataset1) and bind that again, then the template displayes the appointments again.
somehow for the second datset, its as though the template does not refresh. I am urgently needing a reply.
Can you help to reply. Thanks.
(shehan@ares.com.au)
I initiate a RadSchedular by code
I set the template also by code. When I first load the page, and bind the data, the appointments display perfectly (dataset1).
When I query another dataset(dataset2) and bind the appointment template does not refresh, although the resources are displayed correctly.
If I go back to the first dataset (dataset1) and bind that again, then the template displayes the appointments again.
somehow for the second datset, its as though the template does not refresh. I am urgently needing a reply.
Can you help to reply. Thanks.
(shehan@ares.com.au)
0
ARES
Top achievements
Rank 1
answered on 29 Apr 2013, 07:47 AM
Hi I have a major problem.
I initiate a RadSchedular by code
I set the template also by code. When I first load the page, and bind the data, the appointments display perfectly (dataset1).
When I query another dataset(dataset2) and bind the appointment template does not refresh, although the resources are displayed correctly.
If I go back to the first dataset (dataset1) and bind that again, then the template displayes the appointments again.
somehow for the second datset, its as though the template does not refresh. I am urgently needing a reply.
Can you help to reply. Thanks.
(shehan@ares.com.au)
I initiate a RadSchedular by code
I set the template also by code. When I first load the page, and bind the data, the appointments display perfectly (dataset1).
When I query another dataset(dataset2) and bind the appointment template does not refresh, although the resources are displayed correctly.
If I go back to the first dataset (dataset1) and bind that again, then the template displayes the appointments again.
somehow for the second datset, its as though the template does not refresh. I am urgently needing a reply.
Can you help to reply. Thanks.
(shehan@ares.com.au)
RadScheduler radSchedular =
new
RadScheduler();
radSchedular.ID =
"BookingTimeSlotsRadSchedular"
;
radSchedular.Enabled =
true
;
radSchedular.DataKeyField =
"BookingTimeSlotId"
;
radSchedular.DataStartField =
"StartDateTime"
;
radSchedular.DataEndField =
"EndDateTime"
;
radSchedular.DataSubjectField =
"StaffName"
;
radSchedular.MinutesPerRow = interview.Duration;
radSchedular.DayStartTime = Convert.ToDateTime(session.DateFrom).TimeOfDay;
radSchedular.DayEndTime = Convert.ToDateTime(session.DateTo).TimeOfDay;
radSchedular.SelectedView = SchedulerViewType.DayView;
radSchedular.SelectedDate = Convert.ToDateTime(session.DateFrom);
radSchedular.TimelineView.UserSelectable =
false
;
radSchedular.WeekView.UserSelectable =
false
;
radSchedular.MonthView.UserSelectable =
false
;
radSchedular.DayView.UserSelectable =
false
;
radSchedular.CustomAttributeNames =
new
string
[] {
"BookingTimeSlotId"
,
"InterviewId"
,
"SessionId"
,
"StaffId"
,
"StaffName"
,
"ParentId"
,
"ParentName"
,
"StartDateTime"
,
"EndDateTime"
,
"StudentId"
,
"StudentName"
,
"Booked"
,
"Active"
,
"SelectionLimit"
,
"CreateDate"
,
"ModifiedDate"
,
"ModifiedBy"
,
"Ts"
,
"SelectedStudentId"
,
"SelectedParentId"
,
"SelectedInterviewId"
,
"SelectedSessionId"
};
//Resources--------------------------------------------------
ResourceType staffResType =
new
ResourceType(
"Staffs"
);
staffResType.DataSource = staffResources;
staffResType.ForeignKeyField =
"StaffId"
;
staffResType.KeyField =
"StaffId"
;
staffResType.TextField =
"StaffName"
;
radSchedular.ResourceTypes.Add(staffResType);
//radSchedular.Resources.Add(new Resource("Foreman", 160, "A"));
//radSchedular.Resources.Add(new Resource("Foreman", 529, "B"));
//-------------------------------------------------------------
//Appointment Template---------------------------------------
radSchedular.Appointments.Clear();
AppTemplate apptmp =
new
AppTemplate();
radSchedular.AppointmentTemplate = apptmp;
//----------------------------------------------------------
radSchedular.GroupBy =
"Staffs"
;
radSchedular.GroupingDirection = GroupingDirection.Horizontal;
radSchedular.DataSource = bookingtimeslots;
radSchedular.ReadOnly =
false
;
radSchedular.AppointmentDataBound +=
new
AppointmentDataBoundEventHandler(radSchedular_AppointmentDataBound);
radSchedular.AppointmentCommand +=
new
AppointmentCommandEventHandler(radSchedular_AppointmentCommand);
radSchedular.DataBind();
this
.PlaceHolderBookingTimeSlots.Controls.Add(radSchedular);
//=================================================================================
public
class
AppTemplate : ITemplate
{
public
void
InstantiateIn(Control container)
{
Literal ltlApptDisplay =
new
Literal();
ltlApptDisplay.ID =
"LtlApptDisplay"
;
ltlApptDisplay.DataBinding += ltlApptDisplay_DataBinding;
container.Controls.Add(ltlApptDisplay);
//CheckBox chkSelectBooking = new CheckBox();
//chkSelectBooking.ID = "ChkSelectBooking";
//chkSelectBooking.CheckedChanged += new EventHandler(chkSelectBooking_CheckedChanged);
//chkSelectBooking.AutoPostBack = true;
//chkSelectBooking.Text = "Select";
//container.Controls.Add(chkSelectBooking);
RadButton radButton =
new
RadButton();
radButton.ID =
"radBtnSel"
;
//radButton.Click += new EventHandler(radButton_Click);
radButton.Text =
" Book "
;
radButton.Width =
new
Unit(60);
radButton.CommandName =
"SELECT"
;
container.Controls.Add(radButton);
Literal ltlSpace =
new
Literal();
ltlSpace.ID =
"LtlSpace"
;
ltlSpace.Text =
" "
;
container.Controls.Add(ltlSpace);
RadButton radRelButton =
new
RadButton();
radRelButton.ID =
"radBtnRel"
;
//radRelButton.Click += new EventHandler(radRelButton_Click);
radRelButton.CommandName =
"RELEASE"
;
radRelButton.Width =
new
Unit(60);
radRelButton.Text =
" Release "
;
container.Controls.Add(radRelButton);
}
//void radRelButton_Click(object sender, EventArgs e)
//{
// RadButton radButton = (RadButton)sender;
// SchedulerAppointmentContainer aptCont = (SchedulerAppointmentContainer)radButton.Parent;
// Appointment app = aptCont.Appointment;
// int selApptId = Convert.ToInt32(app.ID);
// this.ModifyBookingTimeSlot(app, true);
//}
//void radButton_Click(object sender, EventArgs e)
//{
// RadButton radButton = (RadButton)sender;
// SchedulerAppointmentContainer aptCont = (SchedulerAppointmentContainer)radButton.Parent;
// Appointment app = aptCont.Appointment;
// int selApptId = Convert.ToInt32(app.ID);
// this.ModifyBookingTimeSlot(app, false);
//}
void
chkSelectBooking_CheckedChanged(
object
sender, EventArgs e)
{
CheckBox chkSelectBooking = (CheckBox)sender;
SchedulerAppointmentContainer aptCont = (SchedulerAppointmentContainer)chkSelectBooking.Parent;
Appointment app = aptCont.Appointment;
int
selApptId = Convert.ToInt32(app.ID);
//string staffId = Convert.ToString(app.Attributes["StaffId"]);
//string selectedStudentId = Convert.ToString(app.Attributes["SelectedStudentId"]);
//string selectedParentId = Convert.ToString(app.Attributes["SelectedParentId"]);
//string selectedInterviewId = Convert.ToString(app.Attributes["SelectedInterviewId"]);
//string selectedSessionId = Convert.ToString(app.Attributes["SelectedSessionId"]);
//"BookingTimeSlotId","InterviewId", "SessionId", "StaffId", "StaffName", "ParentId", "ParentName",
//"StudentId", "StudentName", "Booked", "Active", "SelectionLimit", "CreateDate","ModifiedDate","ModifiedBy","Ts",
//"SelectedStudentId", "SelectedParentId","SelectedInterviewId", "SelectedSessionId"
//this.ModifyBookingTimeSlot(app, chkSelectBooking.Checked);
}
#region ltlApptDisplay_DataBinding
/// <summary>
/// ltlApptDisplay_DataBinding
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private
void
ltlApptDisplay_DataBinding(
object
sender, EventArgs e)
{
Literal ltlApptDisplay = (Literal)sender;
IDataItemContainer aptContainer = (IDataItemContainer)ltlApptDisplay.BindingContainer;
//Access the appointment object and set its AllowEdit property:
SchedulerAppointmentContainer aptCont = (SchedulerAppointmentContainer)ltlApptDisplay.Parent;
Appointment app = aptCont.Appointment;
app.AllowEdit =
false
;
app.AllowDelete =
false
;
RadButton radSelButton = (RadButton)aptCont.FindControl(
"radBtnSel"
);
RadButton radRelButton = (RadButton)aptCont.FindControl(
"radBtnRel"
);
//DateTime StartDateTime = Convert.ToDateTime(DataBinder.Eval(aptContainer.DataItem, "Start"));
//DateTime StartEndTime = Convert.ToDateTime(DataBinder.Eval(aptContainer.DataItem, "End"));
//bookingtimeslot.Text = String.Format("{0} - {1}", StartDateTime, StartEndTime);
string
staffId = Convert.ToString(app.Attributes[
"StaffId"
]);
string
staffName = Convert.ToString(app.Attributes[
"StaffName"
]);
string
parentName = Convert.ToString(app.Attributes[
"ParentName"
]);
string
studentName = Convert.ToString(app.Attributes[
"StudentName"
]);
StringBuilder sb =
new
StringBuilder();
sb.AppendFormat(
"{0} - {1}<br/>"
, app.Start, app.End);
sb.AppendFormat(
"Staff: {0}<br/>"
, staffName);
sb.AppendFormat(
"Parent: {0}<br/>"
, parentName);
sb.AppendFormat(
"Student: {0}<br/>"
, studentName);
ltlApptDisplay.Text = sb.ToString();
if
(app.Attributes[
"Active"
] ==
"True"
)
{
app.BackColor = System.Drawing.Color.Gold;
radSelButton.Enabled =
true
;
radRelButton.Enabled =
false
;
if
(app.Attributes[
"Booked"
] ==
"True"
)
{
if
(Convert.ToInt32(app.Attributes[
"ParentId"
]) == Convert.ToInt32(app.Attributes[
"SelectedParentId"
]))
{
app.BackColor = System.Drawing.Color.YellowGreen;
radSelButton.Enabled =
false
;
radRelButton.Enabled =
true
;
}
else
{
app.BackColor = System.Drawing.Color.LightBlue;
radSelButton.Enabled =
false
;
radRelButton.Enabled =
false
;
}
}
}
else
{
app.BackColor = System.Drawing.Color.LightGray;
radSelButton.Visible =
false
;
radRelButton.Visible =
false
;
}
}
#endregion
}
//==========================================================================
0
Hi,
Plamen
the Telerik team
The issue is quite unusual indeed and may be caused by not adding the RadScheduler in the proper event. Would you please specify which in event are you using this code and how exactly are you changing the dataset so we could be more helpful?
Plamen
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.