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.

Changing backcolor in a single row depending on a condition

Thread ID:





21397 Nov 9,2004 09:26 AM Nov 10,2004 05:47 AM Windows Forms 3
Tags: GridControl
Jose Egea
Asked On November 9, 2004 09:26 AM

Hello: I''m new using GridDataBoundGrid and I would like to change the style of a single row using the PrepareViewStyleInfo event, but depending on the cell value of another column. I have enabled dragging columns to reorder them, so how can I get the value of that specific column by his name? And one more question, how can I extend the grid header backgroung until the right side without extending the header of the last column?

Administrator [Syncfusion]
Replied On November 9, 2004 10:05 AM

To get the colIndex from a column name, try: int colIndex = this.grid.Binder.NameToColIndex("SomeName"); If I understand your question about coloring only the header to the right of the visible grid, then I do not know of any grid properties that would help you here. If you want to color the whole area, try setting grid.Properties.BackgroundColor. Another thing to try would be to set grid.HScrollPixel = true to see if this will hide the problem (with this setting you should not see any space to the right unless there are not enough columns to fill the clentwidth in the first place.) If you want try to put up a fake header, you could put up a panel the height of the header row, and try to dock it so it will stick at the top of the grid. This would likely take some trial and error.

Jose Egea
Replied On November 10, 2004 04:23 AM

First question solved. Thanks. As you say I would like to put up a fake header, and it can be a good idea to dock a panel at the top of the grid. But how can I give it the same appearance as a header with ThemesEnabled? Can you help me about that, please?

Administrator [Syncfusion]
Replied On November 10, 2004 05:47 AM

At worst you could dock a second grid into the panel with no rows and a single column there. Then all you would see would be a true grid header which should used the themed drawing. This may be overkill, but it would likely work.


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.