This is a migrated thread and some comments may be shown as answers.

RadScheduler Search w/Open

1 Answer 79 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
jeff357
Top achievements
Rank 2
jeff357 asked on 09 Dec 2011, 04:23 PM
Hi ALL,
    I want to impliment search to radscheduler and
OPEN the Appointment that the text is in how to do?
                                              Any Help Apperciated!
                                                         Jeff Link

   
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
          

1 Answer, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 13 Dec 2011, 03:23 PM
Hi Jeff357,

Thank you for your question.

There is a protected method in RadScheduler called ShowAppointmentEditDialog which opens a specified appointment in the EditAppointmentDialog. You can either inherit from RadScheduler and expose a public method to call the ShowAppointmentEditDialog method or you can use reflection to call it directly. It accepts as arguments the appointment to be opened and a boolean value indicating whether the recurrence editor should also be opened. For you convenience, this method will be exposed as public in the next official release.

As to your question about the case insensitive search, which you asked in another thread, you can use the IndexOf method instead of the Contains method to check if a given string is contained within another. The following code snippet implements both of your requirements:
Private Sub FindAppointment()
    For Each app As Appointment In Me.RadScheduler1.Appointments
 
        If app.Subject.IndexOf(Me.RadTextBox.Text, StringComparison.OrdinalIgnoreCase) >= 0 OrElse
            app.Location.IndexOf(Me.RadTextBox.Text, StringComparison.OrdinalIgnoreCase) >= 0 OrElse
            app.Description.IndexOf(Me.RadTextBox.Text, StringComparison.OrdinalIgnoreCase) >= 0 Then
 
            Me.RadScheduler1.ActiveView.StartDate = app.Start
            Me.RadScheduler1.SchedulerElement.InvalidateMeasure(True)
            SchedulerUIHelper.SelectAppointment(Me.RadScheduler1, app, True)
            Dim mi As MethodInfo = GetType(RadScheduler).GetMethod("ShowAppointmentEditDialog", BindingFlags.Instance Or BindingFlags.NonPublic)
            mi.Invoke(Me.RadScheduler1, New Object() {app,False})
            Exit For
 
        End If
    Next
End Sub

I hope you find this helpful. Feel free to ask if you have any additional questions.

Kind regards,
Ivan Todorov
the Telerik team

Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

Tags
Scheduler and Reminder
Asked by
jeff357
Top achievements
Rank 2
Answers by
Ivan Todorov
Telerik team
Share this question
or