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?

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    There are a number of ways you could achieve what you want. If the cell is read-only, then the easiest thing to do would be to use InitializeRow and simply set the Hidden property on the cell.

    If you don't like the way that looks (with a big empty space where the cell would have been), then the next best option would be to use a CreationFilter to change the text in the UIElements without affecting the data. If you want to go that route, let me know, and I will whip up a small sample CreationFilter for you. It should be pretty simple.

Children