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
335
Cell formatted as F2.
posted

Hi

I am seeing some odd behaviour. I have two cells which are of the Decimal data type. I can confirm this to be true because when do the following:

?this.ultraGridMain.DisplayLayout.Bands[0].Columns[col.Name].DataType

they both are decimals, as they should be because the underlying table column is decimal.

I formatted them as "F2" as follows:

this.ultraGridMain.DisplayLayout.Bands[0].Columns[col.Name].Format = "F2";

I only want the user to see a maximum of 2 decimal places. Which does happen, under certain circumstances which is not good as follows:

When the form opens if i click in a cell:

now, if i change the cell value to a number with no decimals as follows, when i click back on i see no decimals, i am fine with this

now if i change it again and put in decimal places, leave the cell then go back, i only see the two decimal places, which is what i wanted to see when i opened it in the first picture above but didn't:

Now, I will do the same thing again but when i change the figure I will change it to one with decimals

Form is opened, click on cell and see all the decimal places:

Change the decimals

Click back into the cell and this time it shows all the decimals again:

That is inconsistent. If I change the number to one with no demical places then from then on in I only see 2 decimal places, but if i change it to one with decimal places it continues to show all the additional zeros. n.b. underlying data is decimal (28,10) hence 10 decimal places. However, the main point here is the inconsistency in the grid.

Please can you explain how I get that to always be 2 decimal places? I am happy to display none when the number entered has none but I do not want to see 10 decimal places sometimes and not others, it should always be 2.

Thanks

Paul