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
455
WinGrid: Cell Update for decimal value with fix precision
posted

Hi,

I have wingrid with one updatable column which accepts the decimal value. When user edit the value, in the BeforeCellUpdate event I can check whether value is correct (like within a acceptable range etc.) or cancel the change if not. But if the value is correct I need to the round the value to max of 4 decimal points (as use can enter any number of decimal in the field, I am not using any mask control for the field and don't want to use any)  I cannot change the NewValue field in the BeforeCellUpdate event as it is readonly, what is the best way to update the value once user has updated the cell and exited the edit mode before the underlying datasouce is updated.

 Also the grid update mode is set to UpdateMode.OnCellChange

Thx

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    Have you tried simply setting the Value property of the cell?

    If that doesn't work for some reason, then another option would be to do your validation in the BeforeExitEditMode event, instead of BeforeCellUpdate. Then you could examine the Text of the EditorResolved on the cell to do the validation. And if you need to change the value, you would change the Value on the editor.

Children