I have a column(long datatype) on my grid that is Unbound and all the others are Bound. When I click on the header of the unbound column, the column reorders itself but is not sorted. On second click on header, nothing happens.
Sorting of all bound columns work perfectly.
I have not written any code for sorting except for enabling sorting behavior.
Do we have to write any additional code for sorting unbound columns?
This may help you, it may not. I had an issue with using Template Columns where if I tried sorting by these columns then it would completely clear the grid. The solution I found was to add some code behind for the CoumnSorted event:
Dim strPrevSortedColumn As String = ""
If HttpContext.Current.Session("CURRENTSORTEDCOLUMN") IsNot Nothing Then
strPrevSortedColumn = HttpContext.Current.Session("CURRENTSORTEDCOLUMN")
End If
Dim arSortColumn As Array = {"", ""}
If strPrevSortedColumn <> "" Then
arSortColumn = strPrevSortedColumn.Split(",")
If e.Column.Key.Substring(0, 2) = "tc" Then 'All of my Template Column Keys begind with tc
e.SortedColumns.Clear()
If e.Column.Key <> arSortColumn(1) OrElse arSortColumn(0) <> "Asc" Then
e.SortedColumns.Add(Me.[WebDataGridName].Columns("k" & e.Column.Key.Substring(2)), Infragistics.Web.UI.SortDirection.Ascending)
strPrevSortedColumn = "Asc"
Else
e.SortedColumns.Add(Me.[WebDataGridName].Columns("k" & e.Column.Key.Substring(2)), Infragistics.Web.UI.SortDirection.Descending)
strPrevSortedColumn = "Desc"
strPrevSortedColumn = "None"
strPrevSortedColumn &= "," & e.Column.Key
HttpContext.Current.Session("CURRENTSORTEDCOLUMN") = strPrevSortedColumn
[Sub to populate Grid]()
Thanks for your reply. Will try it out.