We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

percent format is changing values

Thread ID:





69926 Nov 19,2007 10:32 AM UTC Nov 21,2007 05:38 AM UTC WinForms 4
Tags: GridControl
Touqeer Ahmed Ahson
Asked On November 19, 2007 10:32 AM UTC


I want to show percent (%) sign with the value in grid.
I am using GridControl,
set column cellValuetype=system.Decimal and apply "P" Format on the column.
the result is strange, if cellvalue is 7 the grid will show it to 700.00 %, and at the same time cellValue is 7.

if I change formatted text to 7.00 % the cellValue becomes .007

I simply want to add percent sign with my value and do not need to change the value. At the same time I dont want not change cellValueType to system.string as it will affect on sorting.

please help.
Touqeer Ahmed Ahson

Administrator [Syncfusion]
Replied On November 19, 2007 04:19 PM UTC

One place you can change the text that is displayed in a cell without having to worry about affecting CellValue's or CellValueType's, etc. is to use the DrawCellDisplayText to do the formatting you want. Here is a little sample.


Touqeer Ahmed Ahson
Replied On November 20, 2007 06:05 AM UTC

thanks a lot. it is working without disturbing original cellvalues.
but there is another problem, as this % is not part of the cellvalue rather just a part of the displaytext so when i call the method of ResizeToFit on column only integer value is visible though % is append with string but it is not visible.

please see the attached solution, in the solution in col 4 the '%' is not visible because i applied resizeToFit on this column, however you can see it by increasing column's width. any solution??

Touqeer Ahmed Ahson


Administrator [Syncfusion]
Replied On November 20, 2007 11:43 AM UTC

The simplest thing to do is to just increase the colwidth a little after calling ResizeToFit.

this.gridControl1.ColWidths[4] += (int) (1 + gridControl1.ColStyles[4].Font.GdipFont.SizeInPoints);

Touqeer Ahmed Ahson
Replied On November 21, 2007 05:38 AM UTC

it is working thanks again


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon