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

Setting styles with PopulateValues

Thread ID:





23227 Jan 6,2005 11:16 PM UTC Jan 9,2005 05:57 PM UTC WinForms 2
Tags: GridControl
Stephen Trinder
Asked On January 6, 2005 11:16 PM UTC

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

Administrator [Syncfusion]
Replied On 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)

Stephen Trinder
Replied On 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!


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