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
300
Hiding a cell value from display
posted

We have several WinGrids that we use as read only search results.  We use 1/1/1900 as a placeholder for a date that has no real value yet.  Previously we had been using string typed columns for dates and then could use a ValueList to 'hide' the 1/1/1900 dates in the grid like this:

vl.ValueListItems.Add("1/1/1900", " ")
vl.ValueListItems.Add("1/1/1900 12:00:00 AM", " ")
vl.ValueListItems.Add("01/01/1900", " ")
vl.ValueListItems.Add("01/01/1900 12:00:00 AM", " ")

Now we are using DateTime typed columns for dates and when the WinGrid column is set to a date style (so it will sort as a date, not as text) the above trick no longer works.  Basically, if the style is default, the ValueList will hide the value in the cell but the sort is text; if the style is any of the Date ColumnStyles then the sort works as expected but the 1/1/1900 values display in the grid.

I've considered something in InitializeRow or maybe even a custom IComparer but both feel like I'm covering up the symptoms rather than fixing the problem.  Any ideas?