GridViewDecimalColumn.DecimalPlaces

5 posts, 0 answers
  1. MikeB
    MikeB avatar
    42 posts
    Member since:
    May 2008

    Posted 27 Jan 2009 Link to this post

    I have a RadGridView with a GridViewDecimalColumn.  A row has the value of 51.34.  I set the DecimalPlaces property to 0 but the value still displays as 51.34.  Should this not display as 51?
  2. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 28 Jan 2009 Link to this post

    Hi MikeB,

    The DecimalPlaces property has effect only on the spin editor when editing the cell. You can control the cell appearance through the FormatString property. The following code removes the fraction part from the cell value:

    this.radGridView1.Columns["Value"].FormatString = "{0:0.}"

    I hope this helps. Do not hesitate to write me back if you have any questions.

    Kind regards,
    Jack
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jippy
    Jippy avatar
    5 posts
    Member since:
    Oct 2012

    Posted 25 Oct 2012 Link to this post

    Hi,
       I have decimal values in telerik grid view data column, i formatted it and showing properly but when i try to edit the value and double click on it, it displays a bunch of zeros after the decimal point.Now i want to remove all those zeros when i double click for editing.Can anybody please help me out on this as soon as possible?
  5. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 30 Oct 2012 Link to this post

    Hi Jippy,

    Thank you for writing.

    If you set the DecimalPlaces property of the column to zero, all decimals should be removed:
    GridViewDecimalColumn col = new GridViewDecimalColumn();
               col.DecimalPlaces = 0;

    I hope this helps.
     
    Kind regards,
    Stefan
    the Telerik team
    Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.
  6. Jippy
    Jippy avatar
    5 posts
    Member since:
    Oct 2012

    Posted 22 Nov 2012 Link to this post

    Hi Stefn, Thanks for the reply.
Back to Top
UI for WinForms is Visual Studio 2017 Ready