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
1470
Editing decimal columns as integer
posted

Hi there

 

I have UltraWinGrid with a bound column of type decimal.

We wish to treat the column as an integer with no spin.

If I set the format of the column to be say "###,###,##0" the format is OK

but if I set the InputMask of the column to say "nnn,nnn,nnn" it by default seems to apply the spin functionality to the columns cells and if I apply the format only with no mask then the first cell I click in displays the value to 4 decimal places.

If instead of using the format and inputmask I use the ColumnStyle = Integer then the column becomes non-editable!

My question is what is the appropriate technique for having both the display and edit mask of a decimal to be that of an Integer.

 

Thanks in advance

geoffhop

Parents
  • 469350
    Suggested Answer
    Offline posted

    Hi Geoff,

    Try something like this:


            private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {
                UltraGridLayout layout = e.Layout;
                UltraGridBand band = layout.Bands[0];

                UltraGridColumn decimalColumn = band.Columns["decimal 1"];
                decimalColumn.Header.VisiblePosition = 1;
                decimalColumn.Format = "###,###,##0";
                decimalColumn.MaskInput = "nnn,nnn,nnn";
                EditorWithMask editorWithMask = decimalColumn.Editor as EditorWithMask;
                editorWithMask.SpinButtonDisplayStyle = SpinButtonDisplayStyle.None;
            }

     

    Note that the grid re-uses the editors that it creates. So in this case, the EditorWithMask I am getting here will apply to ALL columns in the grid that are using masks. If that's not what you want, you will need to create a new editor, set it's SpinButtonDisplayStyle, and assign it to the column, instead of getting the one that is already there.

     

Reply Children