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.

Chnging Color in single cell or row.

Thread ID:

Created:

Updated:

Platform:

Replies:

94768 Jun 1,2010 05:46 AM Aug 13,2010 05:09 AM Windows Forms 5
loading
Tags: GridControl
Michael
Asked On June 1, 2010 05:46 AM

Hi.
How can I change background color in the GridListControl for the single cell or row ?

gridListControl1.Grid[rowindex, colindex].BackColor = Color.FromArgb(((System.Byte)(255)), ((System.Byte)(0)), ((System.Byte)(0))); - doesn't work

Jisha Joy [Syncfusion]
Replied On June 2, 2010 12:54 AM

Hi Michael,

You need to handle Grid.QueryCellInfo event of GridListControl to apply styles to the grid cells.

this.gridListControl1.Grid.QueryCellInfo += new Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventHandler(Grid_QueryCellInfo);

void Grid_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
{
if (e.RowIndex == 2 && e.ColIndex == 2)
e.Style.BackColor = Color.PaleGoldenrod;
}


Please let me know if this helps.

Regards,
Jisha

Michael
Replied On June 3, 2010 06:08 AM

Thank you Jisha.
It's works perfect.

Jisha Joy [Syncfusion]
Replied On June 3, 2010 11:46 PM


Hi Michael,

Thank you for your update.

Regards,
Jisha

Alexey Usanov
Replied On August 12, 2010 06:11 AM

Dear Jisha,
is it possible to access GridControl in GridDataBoundGrid? There is no such propery as Grid here.

Jisha Joy [Syncfusion]
Replied On August 13, 2010 05:09 AM

Hi Alexy,

You could achieve the desired behavior by handling the Model.QueryCellInfo event.

this.gridDataBoundGrid.Model.QueryCellInfo += new Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventHandler(Grid_QueryCellInfo);

void Grid_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
{
if (e.RowIndex == 2 && e.ColIndex == 2)
e.Style.BackColor = Color.PaleGoldenrod;
}

Regards,
Jisha

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.

;