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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Alternate colors in GridListControl

Thread ID:

Created:

Updated:

Platform:

Replies:

30986 Jun 28,2005 05:07 PM UTC Jun 28,2005 05:57 PM UTC WinForms 2
loading
Tags: GridControl
Tom Petrelli
Asked On June 28, 2005 05:07 PM UTC

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.

Administrator [Syncfusion]
Replied On June 28, 2005 05:32 PM UTC

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;
	}
}

Tom Petrelli
Replied On June 28, 2005 05:57 PM UTC

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;
>	}
>}
>
> > >

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

;