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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cell value from within QueryCellStyleInfo

Thread ID:





103719 May 27,2012 09:12 PM UTC May 29,2012 10:57 AM UTC WinForms 2
Tags: Grouping
ian bradley
Asked On May 27, 2012 09:12 PM UTC

private void _gridGroupingControl_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
    // ???

What goes in ??? to get the current cell value based on information available in e?

Just in case there is a better way to do what I want, I want to format the data based on its value. Easy example, format negative numbers in red, or format today's date blue.

ian bradley
Replied On May 28, 2012 10:12 AM UTC

Ok, think I've got it. Basically the grouping control has most of a grid control inside of it. So TableModel has most stuff on it I need.

Asarudheen S [Syncfusion]
Replied On May 29, 2012 10:57 AM UTC

Hi Ian,

Thank you for your interest in Syncfusion products.

You can achieve the reported behavior through "QueryCellStyleInfo" event along with the following code.

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
            if (e.TableCellIdentity.ColIndex == 7 && e.TableCellIdentity.RowIndex>3)
                    int value = int.Parse(e.Style.CellValue.ToString());
                    if (value < 0)
                        e.Style.BackColor = Color.Red;
                        e.Handled = true;

            if (e.TableCellIdentity.ColIndex == 4 && e.TableCellIdentity.RowIndex > 3)

                DateTime dt = (DateTime)e.Style.CellValue;

                if (dt.ToShortDateString()==DateTime.Now.ToShortDateString())
                    e.Style.BackColor = Color.Blue;



Please let us know if this helps.



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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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