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.
Syncfusion Feedback

Alternate row styles

Thread ID:

Created:

Updated:

Platform:

Replies:

63977 Jul 12,2007 06:52 AM UTC Jul 13,2007 11:18 PM UTC Windows Forms 3
loading
Tags: GridControl
Lucia Diaconu
Asked On July 12, 2007 06:52 AM UTC

I could not find the way to define alternate row styles for the grid. Is this possible?

haneefm [Syncfusion]
Replied On July 12, 2007 03:06 PM UTC

Hi Lucia,

Normally, we would recommend you handle PrepareViewStyleInfo to alternately color the rows in a grid. Below is the forum thread that shows this task.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=59492

Best regards,
Haneef

Lucia
Replied On July 13, 2007 02:44 PM UTC

Than you again, Haneef.

Your answer lead me to another solution that I think is better, since I was using the QueryCellInfo event anyway:
if (e.ColIndex == -1) // row style needed
{
if (e.RowIndex % 2 == 1) //odd row
{
e.Style.BackColor = myOddRowColor;
}
}

I like more this method because I have to set the style once per row and not once for each cell. Or is it not so?


haneefm [Syncfusion]
Replied On July 13, 2007 11:18 PM UTC

Hi Lucia,

The QueryCellInfo is hit anytime the grid needs a cell style for any reason. So QueryCellInfo is hit prior to PrepareViewStyleInfo, and may be hit for other reasons than preparing the style for drawing. If you use code like grid[row, col], then QueryCellInfo is hit, but PrepareViewStyleInfo may not hit. So, if you are setting a style property that may be of use to you for something other than be drawn a certain way, then you should use QueryCellInfo to set the property dynamically.

Best regards,
Haneef

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.

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

;