
REgards
Samir
4 Answers, 1 is accepted
Yes, this can be done using the AppointmentComparer property of RadScheduler. Here is how:
class CustomAppointmentComparer : IComparer<Appointment> |
{ |
public int Compare(Appointment first, Appointment second) |
{ |
if (first == null || second == null) |
{ |
throw new InvalidOperationException("Can't compare null object(s)."); |
} |
if (String.Compare(first.Subject, second.Subject) < 0) |
{ |
return -1; |
} |
if (String.Compare(first.Subject, second.Subject) > 0) |
{ |
return 1; |
} |
return 0; |
} |
} |
public partial class _Default : System.Web.UI.Page |
{ |
protected void Page_Init(object sender, EventArgs e) |
{ |
RadScheduler1.AppointmentComparer = new CustomAppointmentComparer(); |
} |
Regards,
Peter
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.

If i remove the code which you sent for alphabatic order , then the size is fixed and its workign fine...but then appointment is not in alphabatic order..??
Help me...
Regards
Samir


Here is the entire script:
Imports Telerik.Web.UI
Imports Microsoft.VisualBasic
Imports System.Collections.Generic
Partial Class _Default
Inherits System.Web.UI.Page
Class CustomAppointmentComparer
Implements System.Collections.Generic.IComparer(Of Telerik.Web.UI.Appointment)
Function Compare(first As Appointment, second As Appointment) As Integer
If first Is Nothing OrElse second Is Nothing Then
Throw New InvalidOperationException("Can't compare null object(s).")
End If
If [String].Compare(first.Subject, second.Subject) < 0 Then
Return -1
End If
If [String].Compare(first.Subject, second.Subject) > 0 Then
Return 1
End If
Return 0
End Function
End Class
Protected Sub Page_Init(sender As Object, e As EventArgs)
RadScheduler2.AppointmentComparer = New CustomAppointmentComparer()
End Sub
Protected Sub RadScheduler1_AppointmentDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerEventArgs) Handles RadScheduler2.AppointmentDataBound
e.Appointment.CssClass = "MyCustomAppointmentStyle"
If e.Appointment.Subject = "Availability" Then
e.Appointment.CssClass = "•rsCategoryYellow"
Else
e.Appointment.CssClass = "rsCategoryGreen"
End If
''e.Appointment.
End Sub
Protected Sub RadScheduler2_FormCreated(ByVal sender As Object, ByVal e As SchedulerFormCreatedEventArgs) Handles RadScheduler2.FormCreated
If (e.Container.Mode = SchedulerFormMode.AdvancedEdit) OrElse (e.Container.Mode = SchedulerFormMode.AdvancedInsert) Then
Dim allDayCheckbox As CheckBox = DirectCast(e.Container.FindControl("AllDayEvent"), CheckBox)
allDayCheckbox.Style.Add("visibility", "hidden")
Dim attrAnnotationsTextbox As RadTextBox = DirectCast(e.Container.FindControl("Subject"), RadTextBox)
attrAnnotationsTextbox.Label = "Type"
attrAnnotationsTextbox.Enabled = False
Dim startPicker As RadTimePicker = DirectCast(e.Container.FindControl("StartTime"), RadTimePicker)
startPicker.TimeView.StartTime = TimeSpan.FromHours(8)
startPicker.TimeView.EndTime = TimeSpan.FromHours(24)
startPicker.TimeView.DataList.DataSource = Nothing
startPicker.TimeView.DataBind()
Dim endPicker As RadTimePicker = DirectCast(e.Container.FindControl("EndTime"), RadTimePicker)
endPicker.TimeView.StartTime = TimeSpan.FromHours(8)
endPicker.TimeView.EndTime = TimeSpan.FromHours(24)
endPicker.TimeView.DataList.DataSource = Nothing
endPicker.TimeView.DataBind()
End If
End Sub
End Class