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

Alternate colors in GridListControl

Is it possible to alternate row colors of a GLC contained in a GridDataBoundGrid cell. Currently, all of the GLC rows inherit whatever the background color is of the cell contained in the GridDataBoundGrid. Thanks.

2 Replies

AD Administrator Syncfusion Team June 28, 2005 12:32 PM

In Form.Load, you can subscribe to the embedded grid''s PrepareViewStyleInfo and use that event to alternate colors. GridDropDownGridListControlCellRenderer cr = this.gridDataBoundGrid1.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; cr.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo);
private void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	if(e.RowIndex % 2 == 1 && e.ColIndex > 0)
	{
		e.Style.BackColor = Color.Red;
	}
}


TP Tom Petrelli June 28, 2005 12:57 PM

Thanks..., works perfect. >In Form.Load, you can subscribe to the embedded grid''s PrepareViewStyleInfo and use that event to alternate colors. > >GridDropDownGridListControlCellRenderer cr = this.gridDataBoundGrid1.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; >cr.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo); > > >
>private void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
>{
>	if(e.RowIndex % 2 == 1 && e.ColIndex > 0)
>	{
>		e.Style.BackColor = Color.Red;
>	}
>}
>
> > >

Loader.
Live Chat Icon For mobile
Up arrow icon