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.

Cell value from within QueryCellStyleInfo

Thread ID:

Created:

Updated:

Platform:

Replies:

103719 May 27,2012 05:12 PM May 29,2012 06:57 AM Windows Forms 2
loading
Tags: Grouping
ian bradley
Asked On May 27, 2012 05:12 PM

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 06:12 AM

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 06:57 AM

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;
                }
            }
        }

Sample:

http://www.syncfusion.com/downloads/Support/DirectTrac/94629/103719-171187510.zip

Please let us know if this helps.

Regards,
Asarudheen.

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.

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.

;