class
CustomAppTemplate : ITemplate
{
private
int
customLines = 0;
public
CustomAppTemplate(
int
customLines)
{
this
.customLines = customLines;
}
public
void
InstantiateIn(Control container)
{
System.Web.UI.HtmlControls.HtmlGenericControl start =
new
System.Web.UI.HtmlControls.HtmlGenericControl(
"span"
);
start.DataBinding +=
new
EventHandler(start_DataBinding);
start.Style.Add(
"white-space"
,
"nowrap"
);
container.Controls.Add(start);
System.Web.UI.HtmlControls.HtmlGenericControl div =
new
System.Web.UI.HtmlControls.HtmlGenericControl(
"span"
);
div.InnerText =
" - "
;
div.Style.Add(
"white-space"
,
"nowrap"
);
container.Controls.Add(div);
System.Web.UI.HtmlControls.HtmlGenericControl end =
new
System.Web.UI.HtmlControls.HtmlGenericControl(
"span"
);
end.DataBinding +=
new
EventHandler(end_DataBinding);
end.Style.Add(
"white-space"
,
"nowrap"
);
container.Controls.Add(end);
System.Web.UI.HtmlControls.HtmlGenericControl lineBreak2 =
new
System.Web.UI.HtmlControls.HtmlGenericControl(
"div"
);
container.Controls.Add(lineBreak2);
System.Web.UI.HtmlControls.HtmlGenericControl subject =
new
System.Web.UI.HtmlControls.HtmlGenericControl(
"span"
);
subject.DataBinding +=
new
EventHandler(subject_DataBinding);
subject.Style.Add(
"white-space"
,
"nowrap"
);
container.Controls.Add(subject);
for
(
int
i = 0; i < customLines - 1; i++)
{
System.Web.UI.HtmlControls.HtmlGenericControl lineBreak =
new
System.Web.UI.HtmlControls.HtmlGenericControl(
"div"
);
container.Controls.Add(lineBreak);
System.Web.UI.HtmlControls.HtmlGenericControl customLine =
new
System.Web.UI.HtmlControls.HtmlGenericControl(
"span"
);
customLine.Style.Add(
"white-space"
,
"nowrap"
);
customLine.DataBinding += customLine_DataBinding;
customLine.InnerText = i.ToString();
container.Controls.Add(customLine);
}
}
void
subject_DataBinding(
object
sender, EventArgs e)
{
System.Web.UI.HtmlControls.HtmlGenericControl customLine = (System.Web.UI.HtmlControls.HtmlGenericControl)sender;
IDataItemContainer aptContainer = (IDataItemContainer)customLine.BindingContainer;
//Access the appointment object and set its AllowEdit property:
Telerik.Web.UI.SchedulerAppointmentContainer aptCont = (Telerik.Web.UI.SchedulerAppointmentContainer)customLine.Parent;
Telerik.Web.UI.Appointment app = aptCont.Appointment;
app.AllowEdit =
false
;
string
strSubject = (
string
)DataBinder.Eval(aptContainer.DataItem,
"Subject"
);
customLine.InnerText = strSubject;
}
void
end_DataBinding(
object
sender, EventArgs e)
{
System.Web.UI.HtmlControls.HtmlGenericControl customLine = (System.Web.UI.HtmlControls.HtmlGenericControl)sender;
IDataItemContainer aptContainer = (IDataItemContainer)customLine.BindingContainer;
//Access the appointment object and set its AllowEdit property:
Telerik.Web.UI.SchedulerAppointmentContainer aptCont = (Telerik.Web.UI.SchedulerAppointmentContainer)customLine.Parent;
Telerik.Web.UI.Appointment app = aptCont.Appointment;
app.AllowEdit =
false
;
string
strSubject = (
string
)DataBinder.Eval(aptContainer.DataItem,
"scheduledend"
);
customLine.InnerText = strSubject +
" "
;
}
void
start_DataBinding(
object
sender, EventArgs e)
{
System.Web.UI.HtmlControls.HtmlGenericControl customLine = (System.Web.UI.HtmlControls.HtmlGenericControl)sender;
IDataItemContainer aptContainer = (IDataItemContainer)customLine.BindingContainer;
//Access the appointment object and set its AllowEdit property:
Telerik.Web.UI.SchedulerAppointmentContainer aptCont = (Telerik.Web.UI.SchedulerAppointmentContainer)customLine.Parent;
Telerik.Web.UI.Appointment app = aptCont.Appointment;
app.AllowEdit =
false
;
string
strSubject = (
string
)DataBinder.Eval(aptContainer.DataItem,
"scheduledstart"
);
customLine.InnerText = strSubject;
}
private
void
customLine_DataBinding(
object
sender, EventArgs e)
{
System.Web.UI.HtmlControls.HtmlGenericControl customLine = (System.Web.UI.HtmlControls.HtmlGenericControl)sender;
IDataItemContainer aptContainer = (IDataItemContainer)customLine.BindingContainer;
//Access the appointment object and set its AllowEdit property:
Telerik.Web.UI.SchedulerAppointmentContainer aptCont = (Telerik.Web.UI.SchedulerAppointmentContainer)customLine.Parent;
Telerik.Web.UI.Appointment app = aptCont.Appointment;
app.AllowEdit =
false
;
int
currentLine = Convert.ToInt32(customLine.InnerText);
string
strSubject = (
string
)DataBinder.Eval(aptContainer.DataItem,
"additionalline"
+ currentLine.ToString());
if
(strSubject.Contains(
"[LINK]"
))
{
if
(strSubject.IndexOf(
"[LINK]"
) + 6 == strSubject.Length)
{
customLine.InnerText = strSubject.Replace(
"[LINK]"
,
""
);
return
;
}
strSubject = strSubject.Replace(
"[LINK]"
,
""
);
string
[] links = strSubject.Split(
new
string
[] {
"|||"
}, StringSplitOptions.RemoveEmptyEntries);
strSubject =
string
.Empty;
foreach
(
string
link
in
links)
{
string
[] values = link.Split(
new
string
[] {
"<|>"
}, StringSplitOptions.RemoveEmptyEntries);
strSubject +=
"<a href=\""
+ values[1] +
"\"target=\"_blank\">"
+ values[0] +
"</a>, "
;
}
strSubject = strSubject.TrimEnd(
", "
.ToCharArray());
customLine.InnerHtml = strSubject;
}
else
customLine.InnerText = strSubject;
}
}
attached are two screenshots. one with compatibility mode enabled and one disabled.