Is it possible to display or hide zero values in a UltraGrid like in Excel? I've bound an ultragrid to a list of objects. Some of the properties of the object are of integer and decimal types. When I do a add new row (i.e., when a new object is created), I want to show blanks instead of 0 or 0.0 in these fields. Excel has a feature to do this (http://office.microsoft.com/en-us/excel/HP051998791033.aspx). Is there a way to do the same using UltraGrid (Wingrid)?
I'm not sure if you can do this. You might be able to use the Format property and see if there is a numeric format that shows blanks when the value is zero.
If your data source supports it, maybe you could initialize the value of the cell to DBNull.Value instead of 0.
Another option might be to use a DataFilter or a DrawFilter. The DrawFilter would only help when the cell is not in edit mode, though.
Thanks Mike. I guess there might be a way to use the format property (in fact the office link that I've in my post above has such a format) but it may not work for me as I am using a value list to display a string instead of a numeric value. I could have added a blank value for a 0 in my value list but my problem is that the valuelist is dependent on some other data in the row and it'll be a pain to add a 0 value for each possible valuelist. There's a way using conditional formatting (which was also suggested in the ms office article). However, its not really elegant. I guess I'll have to make do with it. Here's what it suggests:
Use a conditional format to hide zero values returned by a formula 1. Select the cell that contains the zero (0) value. 2. On the Format menu, click Conditional Formatting. 3. In the box on the left, click Cell Value Is. 4. In the second box from the left, click equal to. 5. In the box on the right, type 0. 6. Click Format, and then click the Font tab. 7. In the Color box, select white.
I'll use this for now and in case you come across a better way, please let me know.
It sounds like your way will only work until you select the colmun, row, or cell. Once something gets selected, you will end up seeing white text on the selected color background.