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

How to only show the color in an EditColor list

Thread ID:

Created:

Updated:

Platform:

Replies:

102403 Jan 27,2012 04:17 PM UTC Feb 1,2012 12:30 PM UTC General Discussion 1
loading
Tags: General Discussion
Alberto Martinez
Asked On January 27, 2012 04:17 PM UTC

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.



Kalaiarasan B [Syncfusion]
Replied On 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


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

;