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

How to only show the color in an EditColor list

Hello I have a datatable with a row defined like so:

DataTable myTable;
myTabe.Columns.Add("Color", typeof(Color));

I have set the datasource of my GridGroupingControl to this datatable.

The color cell shows up correctly. It is a Drop Down List with a color defined and then shows the "RGB" values next to it, like so

[COLOR 255,128,128]

How do I change this to only show the COLOR in the cell? I don't want to see the color name or RGB values.

any ideas?

Thanks.



1 Reply

KB Kalaiarasan B Syncfusion Team February 1, 2012 12:30 PM UTC

Hi Alberto,

Thank you for your interest in Syncfusion products.

To remove the name or value of the color in the cell, please make use of the following code in your application

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.Style.CellValueType == typeof(Color))
{
e.Style.BackColor = (Color)e.Style.CellValue; // sets the back color based on the selected color from dropdown

e.Style.Text = string.Empty; // removes the color name/value
}
}


Please let me know if you have any other concerns.

Regards,
Kalai


Loader.
Live Chat Icon For mobile
Up arrow icon