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
200
re: Custom Formattiing of a wingrid column
posted

Hi,

i have a wingrid where i can bind the data. among them i have two columns in which i place calculated columns. at the end of the value i need to place a "%" sign.

i tried to use the

_uiTargetDetailsDataGrid.DisplayLayout.Bands[ 0 ].Columns[ _percentageReceived ].UseEditorMaskSettings = true;

_uiTargetDetailsDataGrid.DisplayLayout.Bands[ 0 ].Columns[ _percentageReceived ].Format = "{0} %";

but it doesnt seem to be working.

i can go for awork arond and place the value in the cell ... as String.Format( "{0} %", value) .

but i am sure there will be some settings where i can do this in a more generic fashion.

Thank you very much for you help,

 

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

     I think you can do this using the Format property of the column. But the format you are trying to use here isn't correct. Format simply takes the vaule of the cell and calls ToString on it and passes in the format. These kinds of formats don't take a replacement code like "{0}". You have to check out the ToString method of the column's data type. If it's a formula, then the column is most likely a double. So check out the Microsoft documentation on the allowable formats for a double. If memory serves, I think you can just use a format of "p". 

Children
No Data