Infragistics Ultragrid - how to display an empty cell in place of a formatted zero value

ccravenbartle
ccravenbartle used Ask the Experts™
on
I am using an Infragistics Ultragrid to display an accounts ledger.  The grid has a detail column, a debit column and a credit column.  The monetary values have to be formatted and I am setting this within the InitializeLayout event as follows: e.Layout.Bands(0).Columns(2).Format = "£#,##0.00".  This works fine.  

However,  each row will have either a zero debit value and a nonzero credit value or a nonzero debit value and a zero credit value.  The problem is that the zero values are showing as £0.00 in the cells but the users want the cells to be blank if the value is zero.  

What's the best way of doing this?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2006
Commented:
Is it possible to remedy this problem before you reach the grid?  It sounds like it would be a lot easier to pass in null values from the database (assuming that's where the data is coming from), rather than attempting a complex formatting formula.  

With that in mind, you could also loop through each row in your grid and set the "should be blank" cell's value to null.  Definitely not an efficient way of doing it, but it works.

Again, it would be easier to handle this problem when retrieving the data.

Author

Commented:
Thank you ZeonFlash.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial