I am looking for a masked editor that takes numeric values when it has focus, and should display human readable "File Size" when focus leaves the control. eg value 11111 should display 10.85KB when focus moves out of the editor.
Can anyone suggest me which Infragistics editor can help me achieve this? And, the properties I need to set for that particular control?
Sorry for being too vague about the requirement.
Thanks in Advance!
Vishal.
You could use the IEditorDataFilter interface to format the value in the manner you describe here when the control is not focused, by dividing the actual value by 1024 and appending a suffix like "Kb". There is a knowledge base article that demonstrates the basic approach.
You could use an UltraNumericEditor control for this, although I would think since file sizes cannot be changed directly, you would not want to allow editing. If editing is in fact disallowed, there would be no point in using that control, you would be better off using an UltraTextEditor (i.e., no masking).
Thanks for your response!
In my case I have to enter the "FileSize" manually into the textbox, so it needs to be editable.
So what I did is implemented the IEditorDataFilter interface, and added method 'Convert'.
In Convert method i checked 'Conversion Direction'. If its OwnertoEditor and DisplayToEditor, I called the method I created, which converts entered numeric value to KB,MB,TB etc...
Now when I run this, I get an errror "Conversion from string "33.54 kb" to type 'Long' is not valid.".
What could I be missing? If you want I will post the code.