You must be logged in to reply to this topic.
Tagged: Cell, Column Format, Format, Percent sign
Hello guys,
I have a decimal column in a dataset that I want to show on the flex grid with a percent sign (%) next to it. However, I don’t want to the auto formatting to multiply the number by 100 because the field is stored in the dataset as integers between 0-100.
I tried using Column.Format = ’0p’ or ’0%’ but this will multiply the cell by 100 which I don’t want.
is there a way to just add % sign next to the number in each cell in the column using Column.Format??
Thanks,
Thaer
Hello,
You can use OwnerDrawCell event for that matter wherein you can append the % sign after cell 's Text.
private void Form1_Load(object sender, EventArgs e)
{
c1FlexGrid1.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw;
c1FlexGrid1.OwnerDrawCell += new C1.Win.C1FlexGrid.OwnerDrawCellEventHandler(c1FlexGrid1_OwnerDrawCell);
}
void c1FlexGrid1_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e)
{
if (e.Col == IntegerColIndex && e.Row > 0)
{
e.Text = e.Text + " %";
}
}
Hope it helps.
Thanks,
Reeva Dhingra
Thanks Reeva. It helped.
You must be logged in to reply to this topic.
As a leading component vendor in the Microsoft Visual Studio Industry Partner program, ComponentOne has been providing the widest range of Microsoft Visual Studio components, IDE platform development tools, and applications for over 22 years. ComponentOne product lines encompass custom WinForms, ASP.NET, WPF, Silverlight, Mobile, and COM components, documentation tools, and Web Parts for Microsoft Office SharePoint Server and Windows SharePoint Services.
Contact ComponentOne: 1.800.858.2739 | Pittsburgh: 412.681.4343
©2013 ComponentOne LLC All Rights Reserved.
All product and company names herein may be trademarks of their respective owners.
ComponentOne holds a license under Patent No. 5,490,216 (which expires on September 21, 2013)
