Private
Sub
RadButton3_Click(sender
As
System.
Object
, e
As
System.EventArgs)
Handles
RadButton3.Click
If
RadTextBox.Text =
""
Then
MessageBoxEx.ButtonsDividerVisible =
False
MessageBoxEx.Show(
"Please Enter some text to search for!"
,
"Information"
, MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
FindAppointment()
End
If
End
Sub
Private
Sub
FindAppointment()
For
Each
app
As
Appointment
In
Me
.RadScheduler1.Appointments
If
app.Subject.Contains(
Me
.RadTextBox.Text)
Or
app.Location.Contains(
Me
.RadTextBox.Text)
Or
app.Description.Contains(
Me
.RadTextBox.Text)
Then
Me
.RadScheduler1.ActiveView.StartDate = app.Start
Me
.RadScheduler1.SchedulerElement.InvalidateMeasure(
True
)
SchedulerUIHelper.SelectAppointment(
Me
.RadScheduler1, app,
True
)
Exit
For
End
If
Next
End
Sub
Hello!
I've been wanting to implement a copy function for appointments but I can't get it quite right.
The idea is simple, you have a form with a scheduler, which views multiple resources. When you start dragging and keep the control key pressed, you don't actually move the appointment but you copy it.
My code looks like this:
void
rdSchedule_AppointmentDropping(
object
sender, AppointmentMovingEventArgs e)
{
if
(ModifierKeys == Keys.Control)
{
if
(e.Appointment
is
AmfAppointment)
{
AmfAppointment copiedAppointment = ((AmfAppointment)e.Appointment).Copy();
copiedAppointment.Start = e.NewDate;
this
.rdSchedule.Appointments.Add(copiedAppointment);
e.Cancel =
true
;
}
}
}
rdSchedule is the Scheduler control.
AmfAppointment is my own inheritance of an Appointment and Copy() is a function to duplicate the Appointment.
This only (seems to, still some bugs to work out) work for copying an appointment to the same resources.
When dragging the appointment to another resource nothing happens.
Also; the AppointmentMovingEventArgs has a NewDate but no NewResource (i.e.)? And the e.Appointment.ResourceId is the old ResourceId so I can't get it from there either.
What is the right approach here? And if so how can I make this work for copying between different resources as well?
Thank you!
Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated
If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
Dim item As GridEditableItem = TryCast(e.Item, GridEditableItem)
Dim editor As GridTextBoxColumnEditor = DirectCast(item.EditManager.GetColumnEditor("CurrencyTarget_NativeCurrent"), GridTextBoxColumnEditor)
Dim cell As TableCell = DirectCast(editor.TextBoxControl.Parent, TableCell)
Dim validator As New CompareValidator ' RequiredFieldValidator()
editor.TextBoxControl.ID = "NCReqValidator"
validator.ControlToValidate = editor.TextBoxControl.ID
validator.Operator = ValidationCompareOperator.GreaterThanEqual
validator.ValueToCompare = "0"
validator.ErrorMessage = "* Native Current is a required field"
cell.Controls.Add(validator)
End If
End Sub
Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated
If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
Dim item2 As GridEditableItem = TryCast(e.Item, GridEditableItem)
Dim editor2 As GridDropDownListColumnEditor = DirectCast(item2.EditManager.GetColumnEditor("ddCountryCode"), GridDropDownListColumnEditor)
Dim cell2 As TableCell = DirectCast(editor2.DropDownListControl.Parent, TableCell)
Dim validator2 As New CompareValidator ' RequiredFieldValidator()
editor2.DropDownListControl.ID = "CCReqValidator"
validator2.ControlToValidate = editor2.DropDownListControl.ID
validator2.Operator = ValidationCompareOperator.NotEqual
validator2.ValueToCompare = "XXX"
validator2.ErrorMessage = "* Country Code is a required field"
cell2.Controls.Add(validator2)
End If
End Sub
Schedule.ActiveViewType = Telerik.WinControls.UI.SchedulerViewType.Timeline;
Schedule.GetTimelineView().ResourcesPerView = 8;
Schedule.GroupType = GroupType.Resource;
SchedulerDayViewGroupedByResourceElement headerElement = Schedule.SchedulerElement.ViewElement
as
SchedulerDayViewGroupedByResourceElement;
Resource resource;
resource =
new
Resource();
resource.Id =
new
EventId(
"AC00-1"
);
resource.Name =
"AC00-1"
;
resource.Color = Color.Beige;
Schedule.Resources.Add(resource);
resource =
new
Resource();
resource.Id =
new
EventId(
"AC00-2"
);
resource.Name =
"AC00-2"
;
resource.Color = Color.PowderBlue;
Schedule.Resources.Add(resource);
resource =
new
Resource();
resource.Id =
new
EventId(
"AC00-3"
);
resource.Name =
"AC00-3"
;
resource.Color = Color.PowderBlue;
Schedule.Resources.Add(resource);
Schedule.Appointments.BeginUpdate();
Appointment appointment;
appointment =
new
Appointment(
new
DateTime(2011, 12, 07, 12, 00, 00),
new
DateTime(2011, 12, 09, 12, 00, 00),
"Summary"
,
"Descriptions"
,
"Location"
);
appointment.ResourceId =
this
.Schedule.Resources[0].Id;
appointment.BackgroundId = (
int
)AppointmentBackground.Important;
appointment.ToolTipText =
"This is my custom Tooltip"
;
Schedule.Appointments.Add(appointment);
Dim
i1
As
New
Bitmap(fullfilepathtopicture)
'where fullfilepathtopicture is already a string of the full path and filename
Me
.RadRichTextBox1.InsertImage(i1)
rtvUserList.DataSource =
null
;
lsmu = RfcCalls.GetListOfMainUsers();
rtvUserList.DataSource = lsmu;
rtvUserList.DisplayMember =
"DisplayValue\\DisplayValue"
;
rtvUserList.ValueMember =
"Uname"
;
rtvUserList.Name =
"DisplayValue"
;
rtvUserList.ChildMember =
"SIPMainUser\\Subuser"
;
rtvUserList.ClearSelection();