Hi,
I'm trying to format a number in a webmaskeditor control. It is readonly control and I want to display a number in fixed lenght. For example, if I have 45 it should be displayed as 000045. I have tried 000000 as inputmask but it doesn't work. Can someone please suggest me what should it be?
Thanks.
Az
Hello Az,
It sounds like this should be done through code. Set the mask to 999999 (entry not required). Then once the user has entered a value (like on TextChanged or ValueChanged or EnterKeyPress event), you can check the length of the text of the editor. If it's less than 6, then append 0s to the beginning of the text.
You could also set the mask to 000000 (entry required) and handle the InvalidValue event to change the value.
You can find out more about the WebMaskEditor events here.
If this isn't helpful, I can forward your post to developer support and they should be able to assist you.
Elizabeth AlbertLocalization Engineer
Thanks for your reply Elizabeth.
I mentioned it is "readonly" field, I'm just displaying data in it. I could format my data before displaying but i wanted it to be done on UI instead. Is there any other solution like setting some sort of regular expression to format the number automatically instead of writing code to check for format.
You could use a validator as in this sample, but that still involves writing code. You can view the code behind by clicking on the "Source Code" tab at the top.
I will forward your post onto developer support for further assistance.
Thanks Elizabeth.
I saw your point using ASP.Net regular expression control with webmaskeditor in the sample you mentioned. But what I want is using InputMask property of webmaskeditor to set the number format. As you are forwarding my post to a developer, s/he can help me on that.