Hello,
I am using the UltraWingrid in my application. I had a decimal column that can be negative and Wingrid is displaying the -ve value like-> -10.50 corectly.
Suppose I want to enter some negative value or just want to change the 5.25 to -5.25. I am not able to do this because it is not allowing to enter the -ve sign.
Please help me on this.
Hello Manish,
I am still following your thread.
If you still have any other question with this matter please do not hesitate to contact us.
Hello Kaloyan ,
Thanks for your immediate response. Actually I had handled the keypress events of the grid and restricted the characters apart from the '.', Thats why it was not working. Now, I had corrected my earlier code and now it is working.
I had used below code to allow only the number,decimal sign, negative sign and bachspace on edit. Please let me know if there any simple solution available for allowing only decimal value(numbers,decimal sign,backspace and negative sign).
//To allow only numbers,negative sign '-', decimal '.' and bachspace key characters.
private void servicesGrid_KeyPress(object sender, KeyPressEventArgs e) { if (!Char.IsDigit(e.KeyChar)) { this.isAllowedCharKeyPressed = e.KeyChar == '.' || e.KeyChar == '-';
if (e.KeyChar == '\b' || this.isAllowedCharKeyPressed) e.Handled = false; else e.Handled = true; } }
//to handle the error if user presses the Negative Sign '-' key between the numbers. private void servicesGrid_CellDataError(object sender, Infragistics.Win.UltraWinGrid.CellDataErrorEventArgs e) { if (!e.ForceExit) { e.RaiseErrorEvent = false; if (this.servicesGrid.ActiveCell.Column.DataType == typeof(decimal)) { if (this.isAllowedCharKeyPressed) { e.RestoreOriginalValue = true; e.StayInEditMode = true; return; }
} } else { e.RaiseErrorEvent = false; e.StayInEditMode = false; } }
Regards,
Manish
I am still following your thread. Did you solve your issue by using the "UltraGridColumn" MaskInput property ? If not please do not hesitate to contact us and we wil find a solution that will meet your technical requirements.