RadScheduler Search w/Open

2 posts, 0 answers
  1. jeff357
    jeff357 avatar
    27 posts
    Member since:
    Apr 2008

    Posted 09 Dec 2011 Link to this post

    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
              
  2. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 13 Dec 2011 Link to this post

    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.

  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top