Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
Ultra grid sorting a date column with null values
posted

i have an ultra grid and binding it to ultra data source having eight date columns and a date column can have an empty value so i am returning the date columns from the data base as strings. but when i am trying to sort it is sorting as a striring obviously. not able to convert an empty string to date time

I tried making the columns date and returned the date type columns from the database.

any ideas of how to sort a date column with empty values and the grid is read only

 

 

Thank you,

Vidya

Parents
  • 469350
    Offline posted

    Hi Vidya,

    What kind of data source are you using?

    I advise against storing dates as strings. This will cause problems in all sorts of areas like sorting, filtering, exporting, etc.

    The DateTime data type cannot support nulls, but most data source will allow this without using a string. A DataTable, DataSet, or UltraDataSource will all allow you to use null or DBNull for a field value, even if the underlying type (DateTime) does not support it.

    If you must use strings, then you can use the SortComparer property on the column to handle the sorting.

Reply Children
No Data