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
1871
When a row is selected can the cell format be changed.
posted

I know how to change the format on a column but is it possible to change the format on a cell by cell basis?

My data is bound to a dataset. This dataset makes the quantity datatype System.Decimal. I then do a test on each row to see what type it is

(string)e.Row.Cells["Dsp_stype"].Value

If the value is a "P" then I want my quantity  to display 0.000 or its actual value but when the row type is a "C" I want to display blank. I tried using format "#.###" and I did get the desired results for a "C" row type but type "P" gets butchered. Which I would expect considering the format is for the entire column not just the cell I am trying to manipulate.

I have tried to set the cells Active, Selected and Cell appearances ForeColor to be the same as the BackColor but once the row is selected my overrides are ignored.  According to INF support this is by default.

I have added a couple of images to show what my desired results are.

Before a comment row is selected. This is how I want it to look whether the row is selected or not.

How it looks before a row is active.

After a comment row has been selected.