I have a column with dates and strings in my table (varchar) named DateColumn and i want to show it as dates to be able to filter by date. I first tried to create an unbound column with unboundexpression with GetData(DateColumn) and it worked, all the strings with dates where converted to date and the other was #Err. And i was able to filter by date. but i wanted to control these #Err: its empty? its "otherstring"? or its something other? so i tried with CustomUnboundColumnData function:
Try
value = Date.Parse(view.GetListSourceRowCellValue(listSourceRowIndex, columna))
Catch ex As Exception
If IsDBNull(view.GetListSourceRowCellValue(listSourceRowIndex, columna)) Then
value = DBNull.Value
Else
If view.GetListSourceRowCellValue(listSourceRowIndex, columna) = "" Then
value = DBNull.Value
ElseIf view.GetListSourceRowCellValue(listSourceRowIndex, columna) = "otherstring" Then
value = "#otherstring"
Else
value = "#Err"
End If
End If
End Try
but now when I try to filter by value (by date) i get an error:
Cannot compare two items in array.: System.ArgumentException: The object must be of type String.
if I replace the "#Err" and "#otherstring" for DBNull.Value it works again. but i need to be able to put other strings.