I have declared an ultranumeric editor and assigned it to a ultragrid in the editorComponent
The declaration is as follows
UltraNumericEditor ultraNumEditor = new UltraNumericEditor(); ultraNumEditor.SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Always; ultraNumEditor.FormatString = "#0"; ultraNumEditor.NumericType = NumericType.Double; ultraNumEditor.MaskInput = "nnnnnnnnnnn"; ultraNumEditor.Nullable = false; grdTrades.DisplayLayout.Bands[0].Columns[COLUMN_COMMITTEDQUANTITY].EditorComponent = ultraNumEditor; grdTrades.DisplayLayout.Bands[0].Columns[COLUMN_COMMITTEDQUANTITY].CellActivation = Activation.AllowEdit;
The above editor is allowing the user to clear the data and keep it blank, in which case it returns DBNull as the value. I want the NumericEditor control to automatically set the blank value to zero. Also in the above I want the user to enter only non negative numbers without any decimals.
Hello Puneet,
I have investigated your issue and I have asked our engineering staff to examine this further. To be able to track this issue I have created a support ticket for you in our internal tracking system with ID: CAS-129396-R8N4Y7. So I will update you for the progress of this matter trough the mentioned case.
Also to mention we are using the NetAdvantage 2012.1 version.
After review from out developers it turns out that Nullable is not designed to prevent you from setting the Value of the control to null in code. Nullable is really intended to give the control guidance on how to handle empty strings input by the user, whether they should be interpreted as null, or allowed at all.
Please use the approach I have provided you through the case if you still have issues with this.
Please let me know if you have any additional questions.
Hi Mitko,
Can you please clarify how the control will/should behave in both cases. If I specify nullable= false then what value will be assigned to the number behind the control when the user clears the string. Also what will happen when it is true.
I feel the functionality should be that the user should not be allowed to empty the string in case nullable is false, the way it is working on the grid.
Regards,
Puneet
I am just checking about the progress of this issue. Let me know if you need my further assistance on this issue.
Thank you for using Infragistics Components.
Hi Puneet,
This is happening because the grid column uses its own properties and not the properties of the editor. So even if you set the Nullable property of the UltraNumericEditor to false, it still uses the default value of the column which is “Automatic”. When it's set to Automatic, the UltraGrid tries to detect if the column allows null and if so it puts DBNull otherwise it puts empty string (""). If you use embeddable editors in a grid column most of their properties are ignored and the grid uses the column’s properites instead.
The ultranumericeditor is not behaving in the above way when it is inside the grid for nullable false. The value assigned is DBnull.Value even when the Nullable property is set to false.
This was the original problem which I had mentioned and which still working wrong. We have workarounds around it but this functionality for ultranumericeditor is working wrong.
Thank you for the reply.
If Nullable is set to false and the string is cleared the value of the editor becomes 0. If it is set to true, the value will be DBNull.Value.
My comment on 15 Jan has still not been answered