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.
Unfortunately, activation email could not send to your email. Please try again.

percent format is changing values

Thread ID:

Created:

Updated:

Platform:

Replies:

69926 Nov 19,2007 05:32 AM Nov 21,2007 12:38 AM Windows Forms 4
loading
Tags: GridControl
Touqeer Ahmed Ahson
Asked On November 19, 2007 05:32 AM

Hi,

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.
Regards
Touqeer Ahmed Ahson


Administrator [Syncfusion]
Replied On November 19, 2007 11:19 AM

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.



SyncScrolling_2.zip

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

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??

Regards,
Touqeer Ahmed Ahson



SyncScrol.zip

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

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

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




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

it is working thanks again


CONFIRMATION

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.

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.

;