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 do I set the BackColor for GDBG from outside the control?

Thread ID:

Created:

Updated:

Platform:

Replies:

39472 Jan 9,2006 07:44 PM UTC Jan 10,2006 02:51 PM UTC Windows Forms 3
loading
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.

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

;