or
protected
void
RadScheduler1_TimeSlotCreated(
object
sender, TimeSlotCreatedEventArgs e)
{
// checking if the current time slot is blocked
if
(TimeSlotBlocked(e.TimeSlot.Resource.Key.ToString(), e.TimeSlot.Start, e.TimeSlot.End))
{
e.TimeSlot.CssClass =
"Disabled"
;
}
}
protected
bool
TimeSlotBlocked(String pt, DateTime dt1, DateTime dt2)
{
foreach
(PTBlockedTime bt
in
blockedTime)
{
if
((pt == bt.PersonalTrainerId) && ((dt1.AddMinutes(+1) >= bt.Start && dt1.AddMinutes(+1) <= bt.End) || (dt2.AddMinutes(-1) >= bt.Start && dt2.AddMinutes(-1) <= bt.End)))
{
return
true
;
}
}
return
false
;
}
public
struct
PTBlockedTime
{
public
String PersonalTrainerId;
public
DateTime Start;
public
DateTime End;
public
PTBlockedTime(String pt, DateTime dt1, DateTime dt2)
{
PersonalTrainerId = pt;
Start = dt1;
End = dt2;
}
}
.
.
.
List<PTBlockedTime> blockedTime =
new
List<PTBlockedTime>();
DateTime aux1 =
new
DateTime(2012, 1, 25, 8, 0, 0);
DateTime aux2 =
new
DateTime(2012, 1, 25, 10, 0, 0);
PTBlockedTime aux =
new
PTBlockedTime(
"575204"
, aux1, aux2);
blockedTime.Add(aux);
protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
{
//add the new appointment to the db
int? recurrentParentId = null;
if (e.Appointment.RecurrenceParentID != null) recurrentParentId = (int)e.Appointment.RecurrenceParentID;
AppointmentManager.AddUserAppointment(
UserId,
1,
e.Appointment.Start,
e.Appointment.End,
e.Appointment.RecurrenceRule,
recurrentParentId,
e.Appointment.Description,
e.Appointment.Subject);
BindSchedule();
}
mySchedule.DataSource = GetSchedule(); //calls the database and gets the appointments
mySchedule.DataBind();
<
telerik:RadScheduler
runat
=
"server"
ID
=
"mySchedule"
DayStartTime
=
"08:00:00"
DayEndTime
=
"22:00:00"
StartInsertingInAdvancedForm
=
"true"
ShowNavigationPane
=
"true"
OnAppointmentInsert
=
"RadScheduler1_AppointmentInsert"
OnAppointmentUpdate
=
"RadScheduler1_AppointmentUpdate"
OnAppointmentDelete
=
"RadScheduler1_AppointmentDelete"
DataKeyField
=
"AppointmentId"
DataSubjectField
=
"Subject"
DataDescriptionField
=
"Description"
DataStartField
=
"Start"
DataEndField
=
"EndX"
DataRecurrenceField
=
"RecurrenceRule"
DataRecurrenceParentKeyField
=
"RecurrenceParentId"
FirstDayOfWeek
=
"Monday"
ShowHeader
=
"true"
ShowFooter
=
"false"
>
<
AdvancedForm
Modal
=
"true"
/>
<
DayView
UserSelectable
=
"false"
/>
<
WeekView
UserSelectable
=
"false"
/>
<
MonthView
UserSelectable
=
"false"
/>
<
TimeSlotContextMenuSettings
EnableDefault
=
"true"
/>
<
AppointmentContextMenuSettings
EnableDefault
=
"true"
/>
<
ResourceTypes
>
<
telerik:ResourceType
KeyField
=
"ID"
Name
=
"Type"
TextField
=
"Keyword"
ForeignKeyField
=
"AppointmentTypeID"
DataSourceID
=
"AppointmentTypesDataSource"
/>
</
ResourceTypes
>
<
ResourceStyles
>
<
telerik:ResourceStyleMapping
Type
=
"Type"
Text
=
"Event"
ApplyCssClass
=
"rsCategoryGreen"
/>
<
telerik:ResourceStyleMapping
Type
=
"Type"
Text
=
"Personal"
ApplyCssClass
=
"rsCategoryBlue"
/>
<
telerik:ResourceStyleMapping
Type
=
"Type"
Text
=
"Meeting"
ApplyCssClass
=
"rsCategoryYellow"
/>
</
ResourceStyles
>
<
AppointmentTemplate
>
<!--narrowed down template-->
<
div
>
<
h2
>
<%# Eval("Subject") %>
</
h2
>
<
div
>
</
div
>
</
div
>
</
AppointmentTemplate
>
</
telerik:RadScheduler
>
<
script
type
=
"text/javascript"
>
function RedirectUser(sender, args) {
GetRadWindow().BrowserWindow.location.href = '../ThisPageWhenRedirectUser.aspx';
GetRadWindow().close(); //closes the window
}
function GetRadWindow() //Get reference to window
{
var oWindow = null;
if (window.radWindow)
oWindow = window.radWindow;
else if (window.frameElement.radWindow)
oWindow = window.frameElement.radWindow;
return oWindow;
}
</
script
>
'after database has retrieved and stored the value in session
If (Session("UserType") = Something Then CloseRadAndRedirect()
Public Sub CloseRadAndRedirect()
If (Not ClientScript.IsStartupScriptRegistered("GetRadWindow")) Then
ScriptManager.RegisterStartupScript(Page, Me.GetType(), "GetRadWindow", "RedirectUser();", True)
End If
End Sub
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if ((e.Item is GridEditableItem && e.Item.IsInEditMode))
{
GridEditableItem item = e.Item as GridEditableItem;
GridTextBoxColumnEditor editor = (GridTextBoxColumnEditor)item.EditManager.GetColumnEditor(Convert.ToString(ViewState["ColName"]));
TableCell cell = (TableCell)editor.TextBoxControl.Parent;
RequiredFieldValidator validator = new RequiredFieldValidator();
editor.TextBoxControl.ID = "txtValue";
validator.ControlToValidate = editor.TextBoxControl.ID;
validator.ErrorMessage = "*";
cell.Controls.Add(validator);
}
}
protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
{
string tableName = rcbLkup.SelectedValue;
GridDataInsertItem row = (GridDataInsertItem)e.Item;
BLL_LkupMaintenance objLkup = new BLL_LkupMaintenance();
objLkup.ColName = Convert.ToString(ViewState["ColName"]);
//objLkup.LkupValue = row[objLkup.ColName].Text;
objLkup.LkupValue = ((TextBox)row.Controls[4].Controls[0]).Text;
objLkup.AddToLkupTable(tableName);
}
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
CellSpacing
=
"0"
GridLines
=
"None"
onprerender
=
"RadGrid1_PreRender"
onupdatecommand
=
"RadGrid1_UpdateCommand"
oninsertcommand
=
"RadGrid1_InsertCommand"
onitemdatabound
=
"RadGrid1_ItemDataBound"
>
<
HeaderContextMenu
CssClass
=
"GridContextMenu GridContextMenu_Default"
>
</
HeaderContextMenu
>
<
MasterTableView
EditMode
=
"InPlace"
DataKeyNames
=
"ID"
CommandItemDisplay
=
"Top"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to PDF"
></
CommandItemSettings
>
<
RowIndicatorColumn
FilterControlAltText
=
"Filter RowIndicator column"
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
FilterControlAltText
=
"Filter ExpandColumn column"
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
FilterControlAltText
=
"Filter EditCommandColumn column"
>
</
telerik:GridEditCommandColumn
>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
FilterControlAltText
=
"Filter EditCommandColumn column"
>
</
EditColumn
>
</
EditFormSettings
>
</
MasterTableView
>
<
FilterMenu
EnableImageSprites
=
"False"
>
</
FilterMenu
>
</
telerik:RadGrid
>
var selectedtag = editor.getSelectedElement();
var range = editor.getSelection().getRange();
var selection = editor.getSelection();
if (selectedtag.tagName != "LI" && selectedtag.tagName != "P") {
var sel = editor.getSelection().getText();
var text = selectedtag.innerHTML;
//range.pasteHTML('<
p
>' + sel + '</
p
>');
selectedtag.innerHTML = '<
p
>' + text;
}
else if (selectedtag.tagName == "LI") {
var sel = editor.getSelection().getText();
if (sel == "") {
range.pasteHTML('</
li
><
li
>...</
li
>');
}
else {
range.pasteHTML('</
li
><
li
>' + sel + '</
li
>');
}
}
else if (selectedtag.tagName == "P") {
var sel = editor.getSelection().getText();
if (sel == "") {
range.pasteHTML('</
p
><
p
>');
}
else {
range.pasteHTML('</
p
><
p
>' + sel + '</
p
>');
}
}
else {
var sel = editor.getSelection().getText();
if (sel == "") {
range.pasteHTML('</
p
><
p
>');
}
else {
range.pasteHTML('</
p
><
p
>' + sel + '</
p
><
p
>');
}
}
Te Text to the left is empty (ie selection is at the start of the element): <p> selected text text to the right</p>
3) Text to the right is empty (ie selection is at the end of the element): <p>Text to the left selected text </p>
i need the output like,
<p> selected text</p><p>text to the right</p>
How to check if the selected text /range contains any text before and after the selected text.
This is urgent requirement.
Thanks ,
Uma