Grid control Order column MonthCalendar

Hello.
I use this procedure to order a control grid by clicking on the header.

Public Sub OrderCol(ByRef grdGrid As Syncfusion.Windows.Forms.Grid.GridControl, ByVal col As Integer)
Dim style As New GridStyleInfo
Dim dir As ListSortDirection =ListSortDirection.Ascending
Dim col1 As Integer

If grdGrid.CurrentCell.IsEditing Then
grdGrid.CurrentCell.EndEdit()
End If

style.Tag = ""

While col1 <= grdGrid.ColCount
If col1 <> col AndAlso grdGrid(0, col1).CellType = "ColumnHeaderCell" Then
grdGrid(0, col1).CellType = "Header"
Exit While
End If
col1 += 1
End While

grdGrid(0, col).CellType = "ColumnHeaderCell"

If grdGrid(0, col).HasTag Then
If CType(grdGrid(0, col).Tag, ListSortDirection) = ListSortDirection.Ascending Then
dir = ListSortDirection.Descending
End If
End If

grdGrid(0, col).Tag = dir

grdGrid.Data.SortByColumn(col, dir)

grdGrid.Refresh()

End Sub


But when the column is of type 'MonthCalendar' does not sort correctly by date. How I can do to sort it?





Environment:
Visual Basic.Net 2003
Syncfusion version: 4.4.0.51




3 Replies

RB Ragamathulla B Syncfusion Team February 18, 2012 04:20 PM UTC

Hi Muii,

Thank you for your interest in syncfusion products.

You can sort the DateTime column by declare "cellValueType". please refer to the attached sample which illustrates the same.

Let me know if you have any further concerns.

Regards,
Ragamathullah B.



CS_7d51bbad.zip


MU muii February 22, 2012 10:46 AM UTC

Perfect!
We must set the property "cellValueType" to DateTime
In addition the property "CellValue" must contain a variable of type DateTime.

example:
.CellValue = CDate ("10/02/2012")



AS Asarudheen S Syncfusion Team February 28, 2012 10:33 AM UTC

Hi Mulli,

Thanks for the update.

When you set the cell value type to the column ,all cell value would be the date time. Here we dont need any conversion.

Please let us know if you have any other concerns.

Regards,
Asarudheen.


Loader.
Up arrow icon