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

Setting styles with PopulateValues

I''m using a GridControl and populating it by sending an array (created at runtime) to the grid. Is there any way of setting the BaseStyle of a specific cell when using PopulateValues? I assume PopulateValues is just a fast way of getting raw data into the grid without any formating. Will I need to use the Indexer to populate the grid, and set the cell style as I loop through the rows and columns? Thanks. -Stephen

2 Replies

AD Administrator Syncfusion Team January 7, 2005 05:18 AM UTC

Populate values does not support setting styles. You will have to loop through the individual cells you want to set. Using an indexer on the grid to set the styles (grid[row,col].BackColor = x) does raise events. If you are only doing a few cells, then you will not notice this, but if you have many such cells to populate, then you should call SetCellInfo, passing true and false for the last two arguments.
/// 
/// Changes the cell contents at a specific row and column index and allows you to suppress raising  events
/// and also avoid copying the style objects.
/// 
/// The row index.
/// The column index.
/// The  object that holds cell information.
/// A  that specifies the style operation to be performed.
/// A  that indicates if the operation was successful.
/// If True, the method will not raise the  event.
/// If True, the method will try to assign the style object directly. This is only possible if the
/// existing cell was empty before or if modifyType is . Otherwise it will apply the object as
/// specified in modifyType.
public bool SetCellInfo(int rowIndex, int colIndex, GridStyleInfo style, StyleModifyType modifyType, bool dontRaiseSaveCellInfoEvent, bool copyReferenceOnly)


ST Stephen Trinder January 9, 2005 05:57 PM UTC

Hi Clay. Thanks a lot for that! I am trying to get the most speed I can out of my app, and your help so far has been great!

Loader.
Live Chat Icon For mobile
Up arrow icon