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
95
Rounding the decimal value for a floating data type
posted

Hello Infragistics ,

                          I have a formula ((([Usable_Volume]/[Current_Volume])*100)) in a cell and the formula is calculating fine. I don't want a long decimal value instead I want it short say 25.6. How can I do that using Web Cal Manager. Is there any function available in Infragistics grid for such process

Parents
No Data
Reply
  • 364
    posted

    Hi,

    I solved this issue by setting the following for the WebGrid Column that contains the data I want to format.  In the InitializeLayout section for your WebGrid, set the Format of the column to ###,###,##0.0 (if you want thousands sepaerators) or ########0.0 (if you don't want thousands separator).  I also set the DataType of the Column to "System.Double".  The resulting code would look something like this:

    protected void UltraWebGrid1_InitializeLayout(object sender, LayoutEventArgs e)

    {

    c = UltraWebGrid1.DisplayLayout.Bands[0].Columns[0];

    c.DataType = "System.Double";

    c.Format = "###,###,##0.0";

    c.CellStyle.HorizontalAlign = HorizontalAlign.Right;

    }

    On top of this, I formatted my actual values during DataBinding using Math.Round(Convert.ToDouble(value),1).

    I hope this helps you are anyone else who has these same issues.

    Mark

Children
No Data