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. Image for the cookie policy date
close icon

Showing % in a cell

HI I want to change the cellvalue type of a cell as PERCENTAGE.Such that like if for a currency I enter 5 it shows on the grid as $5.SIMILARLY i want to put 5 and the cell should display it as 5%.I hope my Question is clear ....If possible mail me the answer at lokesh.luthra@tatainfotech.com Regards Lokesh

4 Replies

AD Administrator Syncfusion Team August 6, 2004 06:44 AM UTC

If the celltype is double (or decimal), then you can use the P format to display a decimal. style.CellValueType = typeof(double); style.Format = "P"; But this formatting accepts a number like .05 and displays iy a 5%. A 5 would be 500%. (It multiplies the values by 100). Here is forum thread with a sample. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=16888 If you have numbers like 5 and want them displyed like 5% (instead of 500%), then you should handle the QueryCellFormattedText event and add the % there. You would also want to handle the SaveCellFormattedText to strip the % sign back out. If you want email notifications of updates, then you should use our Direct Trac system for your questions.


LL Lokesh Luthra August 6, 2004 06:48 AM UTC

HI Clay Thanx for your prompt reply Infact this is the problem I am facing but I would like to know How I can remove the 00 which is added coz my functionaliuty is like that I cant Ask the user to enter 0.5 >If the celltype is double (or decimal), then you can use the P format to display a decimal. > >style.CellValueType = typeof(double); >style.Format = "P"; > > >But this formatting accepts a number like .05 and displays iy a 5%. A 5 would be 500%. (It multiplies the values by 100). Here is forum thread with a sample. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=16888 > >If you have numbers like 5 and want them displyed like 5% (instead of 500%), then you should handle the QueryCellFormattedText event and add the % there. You would also want to handle the SaveCellFormattedText to strip the % sign back out. > >If you want email notifications of updates, then you should use our Direct Trac system for your questions.


AD Administrator Syncfusion Team August 6, 2004 07:19 AM UTC

You would handle this case using QueryCellFormattedText and SaveCellFormattedText as mentioned in my previous post. Here is a sample.


AD Administrator Syncfusion Team August 6, 2004 07:20 AM UTC

Here is a sample. PushButtonOnCheck_1303.zip

Loader.
Live Chat Icon For mobile
Up arrow icon