Home Forums WinForms controls Xceed Grid for WinForms How to use datepicker in cellviewer Reply To: How to use datepicker in cellviewer

Xceed Support
Member
Post count: 5658

Hi Kai,

There is a workaround for this because by default, the CellEditor does not come up when the value of the DataCell is Nothing. You can intercept the click event on the cell and handling the event yourself. For example:

———-

AddHandler Row.Cells(1).Click, AddressOf CellClicker

———-

and your event handler would look like this:

———-

Private Sub CellClicker(sender As Object, e As EventArgs)
        Console.WriteLine(sender.ToString())
        Dim cell As DataCell = CType(sender, DataCell)

        If (cell.Value = Nothing) Then
            cell.Value = Now
        End If
    End Sub

———-

 

Your basically forcing the CellEditor to come up if the value is Nothing by assigning a default value such as Now to the cell. To the user, they will not see this and they will thing that by bringing the DatePicker they need to choose a date.

Imported from legacy forums. Posted by Marc [Xceed] (had 366 views)