Hello Telerik Team
Small introduction:
I plan to use a RadCalendard on a project for display and edit the public holiday over a year. The list of public holiday is stored in a SQL database (one row is one day) and the data are fetch with EntityFramework. These days are also listed on a listview (with a filter based on the current year displayed on the calendard) for a different point of view. To add a new public holiday, has to doubleclick on the corresponding date in the calendar.
My RadYearCalendar is called YearCalendar
The public holiday are store in an entity called Jourferie with the following properties :
The ToString() Function have an override for displaying the date and the description of a Jourferie
My Radlistview is called ListJourFerie
I use a modal forms Add_Jourferie to get the description and the IsPaid properties when a new public holiday is added.
On this project I use Aqua theme (Not the best choice I agree, but my end-users love Appel's Stuff so...)
I appologize for the frenchy comments on my code !
Okay, so what I have done (could help someone else):
Private Sub View_Calendrier_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load 'We do not want to bind to database in design mode ! If Not Me.DesignMode Then _datactx = New IconEntities(ConnectionManager.GetConnection()) 'Charge les données des jours feriés Me.ListJourFerie.DataSource = _datactx.Jourferie.OrderBy(Function(c) c.Jour) Me.YearCalendar.SpecialDays.Clear() For Each holidayDay As JourFerie In _datactx.Jourferie Me.YearCalendar.SpecialDays.Add(New RadCalendarDay(holidayDay.Jour)) Next 'Déplace le calendrier sur l'année courante Me.YearCalendar.FocusedDate = New Date(Today.Year, 1, 1) End IfEnd SubPrivate Sub YearCalendar_ViewChanged(sender As System.Object, e As System.EventArgs) Handles YearCalendar.ViewChanged If Not Me.YearCalendar.IsLoaded Then Exit Sub Try 'Active le filtrage si nécessaire If Not Me.ListJourFerie.EnableFiltering Then Me.ListJourFerie.EnableFiltering = True 'Supprime les filtres actifs Me.ListJourFerie.FilterDescriptors.Clear() 'Filtre la liste afin d'afficher les enregistrements selon l'affichage du calendrier Me.ListJourFerie.FilterDescriptors.Add("Jour", Telerik.WinControls.Data.FilterOperator.IsGreaterThanOrEqualTo, Me.YearCalendar.DefaultView.Children(0).ViewStartDate) Me.ListJourFerie.FilterDescriptors.Add("Jour", Telerik.WinControls.Data.FilterOperator.IsLessThanOrEqualTo, Me.YearCalendar.DefaultView.Children(11).ViewEndDate) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation, ex.GetType.ToString) End TryEnd SubPrivate Sub YearCalendar_DoubleClick(sender As System.Object, e As Windows.Forms.MouseEventArgs) Handles YearCalendar.MouseDoubleClick Dim cell As CalendarCellElement = TryCast(Me.YearCalendar.ElementTree.GetElementAtPoint(e.Location), CalendarCellElement) If cell IsNot Nothing AndAlso Not cell.VisualState.Contains("Header") Then Dim formAddJour As New Add_Jourferie() formAddJour.Jour.Text = cell.Date.ToShortDateString If formAddJour.ShowDialog() = DialogResult.OK Then Dim newrecord As New JourFerie() With {.Jour = cell.Date, .Description = formAddJour.Description.Text, .IsPaid = formAddJour.IsPaid.Checked} _datactx.Jourferie.AddObject(newrecord) Try _datactx.SaveChanges() Me.YearCalendar.SpecialDays.Add(New RadCalendarDay(newrecord.Jour)) Me.ListJourFerie.DataSource = _datactx.Jourferie.OrderBy(Function(c) c.Jour) Catch ex As UpdateException MsgBox(String.Format("{0}{1}{2}", ex.Message, vbNewLine, ex.InnerException.Message), MsgBoxStyle.Exclamation, ex.GetType.ToString()) _datactx.Jourferie.DeleteObject(newrecord) End Try End If End If End SubBut I need some help for :
By the way... :
.
if winforms gridview also have the same property please tell me where i need to set it???, i checked in the below link, but there is no option to set
void myGrid_UserAddedRow(object sender, GridViewRowEventArgs e) { }