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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Changing backcolor in a single row depending on a condition

Thread ID:





21397 Nov 9,2004 02:26 PM UTC Nov 10,2004 10:47 AM UTC WinForms 3
Tags: GridControl
Jose Egea
Asked On November 9, 2004 02:26 PM UTC

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 03:05 PM UTC

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 09:23 AM UTC

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 10:47 AM UTC

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.

Please sign in to access our forum

This page will automatically be redirected to the 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

Live Chat Icon For mobile
Live Chat Icon