Syncfusion - GridControl - Syncfusion
MonthCalendar Working in gridControl
MonthCalendar CellType Is not supported by Our DLL. We have MaskedEdit CellType for DateControl. So to have MonthCalendar Feature This how you Can Work Out. Place MaskedEdit Column and Second Column for MonthCalendar Control. As Shown in Images
Private Sub mc_DateChanged(sender As Object, e As DateRangeEventArgs)
GridControl1.Item(GridControl1.CurrentCell.RowIndex, 1).CellValue = CType(sender, MonthCalendar).SelectionStart.ToString("dd/MM/yy")
'Console.WriteLine("DateChanged fired")
End Sub
Private Sub GridControl1_CurrentCellAcceptedChanges(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles GridControl1.CurrentCellAcceptedChanges
If GridControl1.CurrentCell.ColIndex = 1 Then
GridControl1.Item(GridControl1.CurrentCell.RowIndex, 2).CellValue = GridControl1.Item(GridControl1.CurrentCell.RowIndex, 1).CellValue
End If
End Sub
Dim cr As GridDropDownMonthCalendarCellRenderer = GridControl1.CellRenderers("MonthCalendar")
If cr.ColIndex = 2 Then
For Each C As Control In cr.DropDownContainer.Controls
If TypeOf C Is MonthCalendar Then
Dim mc As MonthCalendar = C
If GridControl1.Item(GridControl1.CurrentCell.RowIndex, 1).CellValue.ToString <> String.Empty Then
mc.SelectionStart = GridControl1.Item(GridControl1.CurrentCell.RowIndex, 1).CellValue
End If
AddHandler mc.DateChanged, AddressOf mc_DateChanged
End If
Next
End If
End Sub
RunTime
Private Sub GridControl1_CurrentCellActivated(sender As Object, e As EventArgs) Handles GridControl1.CurrentCellActivated
Dim cr As GridDropDownMonthCalendarCellRenderer = GridControl1.CellRenderers("MonthCalendar")
If cr.ColIndex = 2 Then
For Each C As Control In cr.DropDownContainer.Controls
If TypeOf C Is MonthCalendar Then
Dim mc As MonthCalendar = C
If GridControl1.Item(GridControl1.CurrentCell.RowIndex, 1).CellValue.ToString <> String.Empty Then
mc.SelectionStart = GridControl1.Item(GridControl1.CurrentCell.RowIndex, 1).CellValue
End If
AddHandler mc.DateChanged, AddressOf mc_DateChanged
End If
Next
End If
End Sub
Dim cr As GridDropDownMonthCalendarCellRenderer = GridControl1.CellRenderers("MonthCalendar")
If cr.ColIndex = 2 Then
For Each C As Control In cr.DropDownContainer.Controls
If TypeOf C Is MonthCalendar Then
Dim mc As MonthCalendar = C
If GridControl1.Item(GridControl1.CurrentCell.RowIndex, 1).CellValue.ToString <> String.Empty Then
mc.SelectionStart = GridControl1.Item(GridControl1.CurrentCell.RowIndex, 1).CellValue
End If
AddHandler mc.DateChanged, AddressOf mc_DateChanged
End If
Next
End If
End Sub
Comments
Post a Comment