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.

Want loop over Syncfusion.Windows.Forms.Grid.Grouping and set e.style.backcolor for specific row.

Thread ID:

Created:

Updated:

Platform:

Replies:

59986 Apr 25,2007 03:39 PM Apr 26,2007 12:39 PM Windows Forms 3
loading
Tags: GridControl
Ashok
Asked On April 25, 2007 03:39 PM

Hi i Want loop over Syncfusion.Windows.Forms.Grid.Grouping and set e.style.backcolor for specific row.

so i want some ////code like

for(int i=;;;)
{
e.style.backcolor ="red";
}

Hi my requirement is change specific row back color at specific time(assume on timer), so how i can do it.????

Rajagopal [Syncfusion]
Replied On April 25, 2007 05:19 PM

Hi Ashok,

You can try the code like this in the QueryCellStyleInfo event of the GridGroupingControl, to color any specific record(row) in grid.

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)
{
Element el = e.TableCellIdentity.DisplayElement;
Record rec = el.ParentRecord;
int recordIndex = this.gridGroupingControl1.Table.Records.IndexOf( rec );
if( recordIndex == 3 )
e.Style.BackColor = Color.Pink;
}
}

Let us know if you have any further queries.
Thanks for using Syncfusion Products.

Regards,
Rajagopal


Ashok
Replied On April 26, 2007 09:51 AM

Hi But i want this event on my click based, where i can loop all rows and get specific row, because this event only fired when Syncfusion.Windows.Forms.Grid.Grouping acitve
.
on click event i am not able to grap
"e.TableCellIdentity.DisplayElement"


>Hi Ashok,

You can try the code like this in the QueryCellStyleInfo event of the GridGroupingControl, to color any specific record(row) in grid.

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)
{
Element el = e.TableCellIdentity.DisplayElement;
Record rec = el.ParentRecord;
int recordIndex = this.gridGroupingControl1.Table.Records.IndexOf( rec );
if( recordIndex == 3 )
e.Style.BackColor = Color.Pink;
}
}

Let us know if you have any further queries.
Thanks for using Syncfusion Products.

Regards,
Rajagopal



Administrator [Syncfusion]
Replied On April 26, 2007 12:39 PM

In your click event, set a flag (or create a collection of row indexes) to indicate that you want to color certain rows. Then inside the QueryCellStyleInfo, check this flag (or check if the rowIndex is in your collection), and if so, then set the BackColor as shown above.

The reason you need to do it this way is that the GridGroupingControl does not store properties for each row. It does this for efficiency (so you can have many, many rows). So, you cannot just set such properties on a row. To affect a visual property on a row or individual cell, you need to do it on demand in a an event (like QueryCellStyleInfo).

Now if you really want to store something on a row by row basis (so you can set it and not have to provide it in an event), then you can create a custom engine which will allow you to create your own row objects which will allow you to add properties such as a row color that you could set. The ResizableRows sample that we ship does this to add a RowHeight property to each row. You could similarly add a Color property, but generally it is simpler to set such properties dynamically in an event like QueryCellStyleInfo.


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.

;