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
2715
UltraGrid cell mask issue
posted

Hi!

I have a ultragrid, and in one of its cells i've set up a mask, like this : 

 

UltraGridColumn column = ulgPricesBudget.DisplayLayout.Bands[0].Columns["FY"];

            column.MaskInput = "20##";

            column.MaskDataMode = MaskMode.IncludeBoth;

            column.MaskDisplayMode = MaskMode.IncludeBoth;

In the BeforeExitEditMode I do a check : 

if (ulgPricesBudget.ActiveCell.Column.Key == "FY" && ulgPricesBudget.ActiveCell.EditorResolved.Value.ToString() != "") { .....  } 

So the mask is like this "20__" - it's an year.

This is the code line that throws an exception if i insert in the masked cell a value like "20_1" (i insert just the last character the "1"). The exception is :

Internal error: can't get masked editor value. Inner exception is: Input does not match the mask.

What am i doing wrong ?

Could you help me in this issue ?

Thanks!

 

  • 5520
    posted

    you can handle it in the celldataerror event by forcing the user to stay in edit mode until he puts the first number

     private void ultraGrid1_CellDataError(object sender, CellDataErrorEventArgs e)

            {

                e.StayInEditMode = true;

                e.RaiseErrorEvent = false;

            }