Hi,
I have an UltraGrid with a column using EditorWithMask for entering numbers as string type. I had the MaskInput set to "nnn,nnn,nnn,nnn,nnn", and it worked just fine showing commas as needed.
var editorSettings = new DefaultEditorOwnerSettings { DataType = typeof(string), MaskInput = "nnn,nnn,nnn,nnn,nnn" };var editorWithMask = new EditorWithMask(new DefaultEditorOwner(editorSettings));
Now I have a requirement for user to enter a number with a "%" optionally. Is there a way to specify such MaskInput? For example, they can enter numbers with or without "%" sign.
100
10
100%
10%
If it's not possible, how do I implement such feature and do you have any examples? Thanks.
Hello Michael,
Thank you for posting on our forums.
As of now UltraMaskedEditor do not have functionality that supports entering a number with “%” optionally. I recommend using an UltraTextEditor and performing a validation to check for the “%” in the input text for achieving this.
You can refer to this link to go over the supported input mask characters of UltraMaskedEditor.
Please let me know if you have any questions.
Do you have any example for UltraTextEditor? I couldn't figure out how to use UltraTextEditor, I am only able to set EmbeddableEditorBase into the column.Editor. I was looking at EditorWithText, but haven't figure out how to validate input as user types while still in edit mode. I read posts where we can do check value BeforeExitEditMode on the grid, but I think it's too late. Please advise. Thanks.
Really all you have to do is NOT do what you are already doing to apply a mask. Don't set the Editor, EditorComponent, MaskInput, or Style property of the column and it will display with as a normal text cell with no masking. Then you can use BeforeExitEditMode to validate the Text of the cell.
UltraTextEditor can be used in a Grid column by simply assigning it to the column’s EditorComponent property. You can then validate the TextEditor text in Validation event or by using a UltraValidator component. Can you please elaborate on the details of why it is too late to trigger the validation in BeforeExitEditMode event? Based on that I can suggest you an alternative event to trigger this validation.
I will further look into this issue as soon as I hear from you.