Different Decimal Formats in Same Column

2 posts, 0 answers
  1. Gary
    Gary avatar
    24 posts
    Member since:
    Jul 2016

    Posted 16 Jul Link to this post

    A gridview (read only) has a quantity column that is normally formatted with zero decimal positions.  Now we have a situation where the values in some rows will have significant decimal values and others will not.  Can I set the decimal format of individual cells (hoping that CellFormatting event is part of that solution)?
  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3988 posts

    Posted 17 Jul Link to this post

    Hello, Gary,

    GridViewDecimalColumn offers the DecimalPlaces property which specifies how many decimal places to be shown in the numeric values. However, this doesn't seem to be suitable for your scenario.

    The appropriate way to achieve different format of the cells belonging to the same column is to use the CellFormatting event and specify the CellElement.Text considering cell's Value, RowInfo and ColumnInfo. Setting the CellElement.Text actually indicates what text to be shown in the cells.

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

Back to Top