Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
703
Question on Masked Input
posted

Hi,

Recently I had a requirement of adding an editable column in the grid which should allow users to enter number with only 4 decimal places. So I had decided to add a masked input column which should suit my problem. So i had added the following code change.

 

 

 

 

 

ultraGrid1.DisplayLayout.Bands[0].Columns[

 

"Mask"].CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction

.Edit;

ultraGrid1.DisplayLayout.Bands[0].Columns[

"Mask"].MaskInput = "-nn,nnn,nnn.nnnn"

;

ultraGrid1.DisplayLayout.Bands[0].Columns[

 

"Mask"].MaskDataMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode

.Raw;

ultraGrid1.DisplayLayout.Bands[0].Columns[

 

"Mask"].MaskClipMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode

.IncludeBoth;

ultraGrid1.DisplayLayout.Bands[0].Columns[

 

"Mask"].MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode

.IncludeBoth;

The problem here is the masked input allows only 4 decimal places, but also restricts user to enter only few numbers to the non decimal places. Say in the above example i had added "-nn,nnn,nnn.nnnn" allows only 8 non decimal numbers. Ma question here is is there a way to only restrict user to enter value 4 decimal values and N non decimal values? Is this achievable thro masked input or is there another way to achieve this?

Please advice.

  • 469350
    Verified Answer
    Offline posted

    Hi,

    No, there's no way to have a mask of indefinite length either for all or part of the mask.

    You could, of course, handle this without using masks by allowing the user to type in anything they want and then validating their entry using an event of the grid, such as BeforeCellUpdate or BeforeExitEditMode.

    Or, if you know of another standalone control that gives you the ability to do this (like the Regex control, maybe), you could embed that control in the grid column using the UltraControlContainerEditor. The UltraControlContainerEditor is fairly new, though. So you would have to have a pretty recent version of NetAdvantage. Also, I'm not sure if the Regex control will do what you want.