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

How do I set the BackColor for GDBG from outside the control?

Thread ID:





39472 Jan 9,2006 07:44 PM UTC Jan 10,2006 02:51 PM UTC WinForms 3
Tags: GridControl
Jay Mooney
Asked On January 9, 2006 07:44 PM UTC

I would like to be able to set the CurrentCell''s background color without having to handle the QueryCellInfo event. I tried: gdbg.Model[rowNdx, colNdx].BackColor = Color.Plum; where rowNdx and colNdx point to the CurrentCell, but no color is ever set.

Administrator [Syncfusion]
Replied On January 10, 2006 05:51 AM UTC

Hi, you can use PrepareViewStyleInfo Event for changing the current cell''s background color of GDBG. Here is the Code snippet. private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { if(e.ColIndex == 3 && e.RowIndex == 3) e.Style.BackColor = Color.Yellow; } Refer this KB article for more details. http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=84 With Regards, Madhan

stanleyj [Syncfusion]
Replied On January 10, 2006 06:53 AM UTC

Hi, To have only the current cell to be of any color, then CurrentCell.HasCurrentCellAt(e.RowIndex, e.ColIndex) has to be checked in the PrepareViewStyleInfo or QueryCellInfo handler. if(this.gridDataBoundGrid1.CurrentCell.HasCurrentCellAt(e.RowIndex, e.ColIndex)) { e.Style.BackColor = Color.Pink; } Best regards, Stanley

Jay Mooney
Replied On January 10, 2006 02:51 PM UTC

I was looking for a way to do this outside of any event. Looks like maybe that can''t be done.


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