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.

Conditional coloring of rows

Thread ID:

Created:

Updated:

Platform:

Replies:

26462 Mar 23,2005 09:38 AM Mar 23,2005 10:44 AM Windows Forms 1
loading
Tags: GridControl
Nicolette Pretorius
Asked On March 23, 2005 09:38 AM

Hi, I''m using PrepareViewStyleInfo to color the grid rows. The color of a row is conditional on a value of a column in the grid. I could get it to work by looking up the row in the bound table which corresponds to GridPrepareViewStyleInfoEventArgs''s RowIndex attribute. This does not work when the rows are sorted and the coloring is done in accordance with the unsorted table. How do I get arround this?

Administrator [Syncfusion]
Replied On March 23, 2005 10:44 AM

Is the test value in the grid? If so, the simplest way is to get it from teh grid itself. int colIndex = grid.Binder.NameToColIndex("TestValueColname"); object testValue = grid[e.RowIndex, colIndex].CellValue; If the value is not displayed in teh grid and you need to get it from teh datassource, then you have to use the CurrencyManager. CurrencyManager cm = grid.BindingContext[grid.DataSoource, grid.DataMember] as CurrencyManager; int pos = grid.Binder.RowIndexToPosition(e.RowIndex); object testValue = ((DataRowView)cm.List[pos])["TextValueColName"]; In this latter case, I think you could cache teh currencymanager in a class member and initialize this member after you set teh datasource to teh grid.

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.

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.

;