applying a mask to an editable cell

Hi....

I have an editable cell in a GGC. In QueryCellStyleInfo, I am trying to set a mask in order to limit the numeric value that a user can type into the cell. The numbers to be entered are share quantities. Positive whole numbers with no currency sign.

e.Style.ReadOnly = false;

e.Style.CellType = "Currency";
e.Style.CurrencyEdit.CurrencyDecimalDigits = 0;
e.Style.CurrencyEdit.CurrencySymbol = "";
GridMaskEditInfo mask = new GridMaskEditInfo();
mask.UsageMode = MaskedUsageMode.Numeric;
mask.Mask = "#,##0";
mask.MinValue = 0;
mask.MaxValue = 99999;
e.Style.MaskEdit = mask;

The above code doesn''t see to have any affect. I can still type in negative numbers and numbers larger than 99999.

What am I doing wrong?

Thanks in advance!

Eric

1 Reply

AD Administrator Syncfusion Team September 19, 2006 04:34 AM UTC

Hi Eric,

The GridStyleInfo.MaskEdit properly is only used with the MaskEdit cell type. So you can change the e.Style.CellType property to "MaskEdit" in the QueryCellStyleInfo event.

e.Style.ReadOnly = false;

e.Style.CellType = "MaskEdit" ;

GridMaskEditInfo mask = new GridMaskEditInfo();
mask.UsageMode = MaskedUsageMode.Numeric;
mask.Mask = "#,##0";
mask.MinValue = 0;
mask.MaxValue = 99999;

e.Style.MaskEdit = mask;

Let me know if something like this will not work for you.

Regards,
Haneef

Loader.
Up arrow icon