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
9364
Grid wide numeric format setting
posted

I have grid binding to Data Table with many numeric columns. Is there a setting at the Grid level to say "all numerics should have two decimal places"?

Thanks!

Parents
  • 1590
    Suggested Answer
    posted

    Hi, vrn

    UltraGrid's column has Format Property that you can use to set format for numerics.

    You can do this as follows:


                foreach (UltraGridBand gridBand in grid.DisplayLayout.Bands)
                {
                    foreach (UltraGridColumn column in gridBand.Columns)
                    {
                        if (column.DataType == typeof(double) || column.DataType == typeof(decimal))
                        {
                            column.Format =  "n2";
                        }
                    }
                }

     

    Thanks, Alex.

Reply Children
No Data