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.

AlternatingRowsDefaultCellStyle

Thread ID:

Created:

Updated:

Platform:

Replies:

90824 Oct 20,2009 06:54 AM Oct 23,2009 02:19 AM Windows Forms 7
loading
Tags: GridControl
Allon
Asked On October 20, 2009 06:54 AM

Hi, everyone

I'm looking something similar to AlternatingRowsDefaultCellStyle. I don't want to be responsible for each row's backcolor (even after I sort the grid). I want everything will be automated.

Thanks in advance, and have a good day :)
Allon

Jisha Joy [Syncfusion]
Replied On October 21, 2009 07:32 AM

Hi Allon,

Thank you for posting query to us. If your intesion is to apply styles to the alternating rows in GridGroupingControl, this can be achieved by using the AlternateRecordFieldCell property of grid. See the code:
this.gridGroupingControl1.TableDescriptor.Appearance.AlternateRecordFieldCell.BackColor = Color.AliceBlue;
this.gridGroupingControl1.TableDescriptor.Appearance.AlternateRecordFieldCell.TextColor = Color.Wheat;

Please let me know if this helps.

Regards,
Jisha

Allon
Replied On October 22, 2009 03:46 AM

Hi, Jisha

Thanks for replying me, but I work with Grid control, and TableDescriptor is not one of it's properties.

Thanks in advance :)
Allon

Allon
Replied On October 22, 2009 05:02 AM

Hello, again

An answer relates to PrepareViewStyleInfo won't be helpful, because There are a lot of problems changing the bgColor after using it.

Regards,
Allon

Jisha Joy [Syncfusion]
Replied On October 22, 2009 06:33 AM

Hi Allon,

In GridControl you can set row styles to the RowStyles property. See the code for setting alternate row setting for GridControl.


//Alternate row styles
for(int i=1;i<=this.gridControl1.RowCount; i++)
{
if(i%2==0)
this.gridControl1.RowStyles[i].BackColor = Color.Pink;
else
this.gridControl1.RowStyles[i].BackColor = Color.LightBlue;
}


Regards,
Jisha

Allon
Replied On October 22, 2009 08:04 AM

Hi Jisha,

This is exactly what I did, but the results are poor when I sort rows in the grid control according to some beautiful solution which Lingaraj S. has sent me in 19/10/2009 (http://www.syncfusion.com/support/forums/grid-windows/90745/grid-control-sorting). If I use that sorting method, and use what you have just suggested me, row's background color remain and it becomes orderless (unless after sorting, I use the loop you have sent me again). I've got no problem to use that loop, but after sorting the grid, there would be a lot of mess, which I want to avoid. It would be great if you could add the ability to take control on alternating background color to the app Lingaraj S. has sent me.

Regards,
Allon

Allon
Replied On October 22, 2009 09:03 AM

Hi Jisha,

I think I found something that works quit fast, and apparently everything will be just fine, if I just write your loop before grdNew.Refresh() in SortCol() subroutine.

Have a nice day :)
Allon

Jisha Joy [Syncfusion]
Replied On October 23, 2009 02:19 AM

Hi Allon,

Thank you for your update.

Regards,
Jisha

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.

;