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.
Syncfusion Feedback

GGC Format column

Thread ID:

Created:

Updated:

Platform:

Replies:

75428 Jul 25,2008 11:16 AM UTC Jul 28,2008 07:09 AM UTC WinForms 3
loading
Tags: GridControl
Simon Kakon
Asked On July 25, 2008 11:16 AM UTC

Hi,
I would like to manage the display value for numeric column like this : if the cell value is 1000 then i want to display 1K, if cell value is 1000000 => 1M ...

is there a way to do that ?

Thanks

Sim


Sri Rajan [Syncfusion]
Replied On July 25, 2008 01:14 PM UTC

Hi Sim,

Thank you for your interest in Syncfusion products.

There is no direct way to do this. but you can achieve this by handling TableControlPrepareViewStyleInfo event. Here is the code.

void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlPrepareViewStyleInfoEventArgs e)
{
string str = e.Inner.Style.Text;
if (e.Inner.Style.Text.Contains("000") && e.Inner.Style.Text.Length==4)
{
str=str.Replace("000", "K");
e.Inner.Style.Text = str;
Console.WriteLine(str);
}
if (e.Inner.Style.Text.Contains("000000") && e.Inner.Style.Text.Length == 7)
{
str=str.Replace("000000", "M");
e.Inner.Style.Text=str;
}
}


Please let me know if this helps.

Best Regards,
Srirajan.


Simon Kakon
Replied On July 25, 2008 03:05 PM UTC

Thanks for the response, but it can't works because the column is of type Int32.

>Hi Sim,

Thank you for your interest in Syncfusion products.

There is no direct way to do this. but you can achieve this by handling TableControlPrepareViewStyleInfo event. Here is the code.

void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlPrepareViewStyleInfoEventArgs e)
{
string str = e.Inner.Style.Text;
if (e.Inner.Style.Text.Contains("000") && e.Inner.Style.Text.Length==4)
{
str=str.Replace("000", "K");
e.Inner.Style.Text = str;
Console.WriteLine(str);
}
if (e.Inner.Style.Text.Contains("000000") && e.Inner.Style.Text.Length == 7)
{
str=str.Replace("000000", "M");
e.Inner.Style.Text=str;
}
}


Please let me know if this helps.

Best Regards,
Srirajan.




Sri Rajan [Syncfusion]
Replied On July 28, 2008 07:09 AM UTC

Hi Sim,

Thank you for your continued interest in Syncfusion products.

A Int32 DataType field does not supports characters. If you want to display format like 1K or 1M in a cell, then you need to change the datatype of the field as string. Please refer the sample code for more details.


dt.Columns.Add("Amount", typeof(string));


Please let me know if this helps.

Best Regards,
Srirajan.


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.

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

;