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 can I change background color of the clicked row

Thread ID:

Created:

Updated:

Platform:

Replies:

60105 Apr 27,2007 11:07 AM UTC Jun 27,2008 10:34 AM UTC Windows Forms 3
loading
Tags: Grouping
Jiri Ludvik
Asked On April 27, 2007 11:07 AM UTC

I need to change background color of entire row in GridGroupingControl when user clicks on any cell in that row.

Tried to do that in TableControlCellClick event, but have no idea how to do that... :(


haneefm [Syncfusion]
Replied On April 27, 2007 09:08 PM UTC

Hi Jiri,

You can try this code.

gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One;
gridGroupingControl1.TableOptions.SelectionBackColor = Color.Red;

Best regards,
Haneef

Karsten Brocksieper
Replied On June 26, 2008 09:52 AM UTC

Hello,

this works really good.

I have one more question regarding this issue. With this code the clicked row change the backcolor --- but not the clicked cell. The backcolor of the clicked cell don´t change.
Is it possible to change the color of the clicked cell too?

Regards,
Karsten




Jisha Joy [Syncfusion]
Replied On June 27, 2008 10:34 AM UTC

Hi Karsten,

This can be achieved by handling the QueryCellStyleInfo event. Please refer the code:



void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
if (e.TableCellIdentity.RowIndex == cc.RowIndex && e.TableCellIdentity.ColIndex == cc.ColIndex)
{

e.Style.BackColor = this.gridGroupingControl1.TableOptions.SelectionBackColor;
this.gridGroupingControl1.TableControl.RefreshRange(GridRangeInfo.Cell(cc.RowIndex, cc.ColIndex));

}
}



Regards,
Jis


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

;