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

GLC Alternate Colors

I have a GGC, with a GridlistControl in one of the TableDescriptor cells. I''m using the following to do alternate colors: GridTableCellStyleInfo style (GridTableCellStyleInfo) e.Inner.Style; if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell) { if (e.Inner.RowIndex > 1 && (e.Inner.RowIndex % 2) == 0) e.Inner.Style.BackColor = System.Drawing.Color.FromArgb(148, 207, 247); else e.Inner.Style.BackColor = System.Drawing.Color.FromArgb(255, 255, 255); } The GLC however, is all one color based on the current cell color. Thanks

7 Replies

AD Administrator Syncfusion Team October 20, 2005 02:13 PM UTC

Your code sets the colors in the GridGroupingControl. It does not try to set the colors in the embedded GridListControl of a cell. To do this, you can subscribe to the PrepareViwStyleInfo event in the Grid property of teh embedded GridListControl, and use that event to provide alternating colors to the dropdown. Here is code that you can use to subscribe to the event. GridDropDownGridListControlCellRenderer cr = this.gridGroupingControl1.TableControl.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; cr.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo);


KM KMS October 21, 2005 12:55 PM UTC

Hi Clay, I have added the code in the form load, but for some reason the event is not getting invoked. My Grid_PrepareViewStyleInfo function is not getting called when my GLC drops down. >Your code sets the colors in the GridGroupingControl. It does not try to set the colors in the embedded GridListControl of a cell. To do this, you can subscribe to the PrepareViwStyleInfo event in the Grid property of teh embedded GridListControl, and use that event to provide alternating colors to the dropdown. Here is code that you can use to subscribe to the event. > >GridDropDownGridListControlCellRenderer cr = this.gridGroupingControl1.TableControl.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; >cr.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo); >

Doc1.zip


AD Administrator Syncfusion Team October 21, 2005 04:06 PM UTC

You are using the GridListControl from a nested table, not the parent table. So, you will have to get the TableControl diferently. The "ChildToGrandChild" used below is the name of the relation that ends at this TableControl. GridDropDownGridListControlCellRenderer cr = this.gridGroupingControl1.GetTableControl("ChildToGrandChild").CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; cr.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo);


KM KMS October 22, 2005 09:56 PM UTC

Thanks fo rthe response Clay, I''m not sure what''s going on at this point. As soon as the code GridDropDownGridListControlCellRenderer cr = this.plannedOrdersGridGroupingControl.GetTableControl("ChildToGrandChild").CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; is executed, I get the old: Object reference not set to an instance of an object error. >You are using the GridListControl from a nested table, not the parent table. So, you will have to get the TableControl diferently. The "ChildToGrandChild" used below is the name of the relation that ends at this TableControl. > >GridDropDownGridListControlCellRenderer cr = this.gridGroupingControl1.GetTableControl("ChildToGrandChild").CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; > cr.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo); >


AD Administrator Syncfusion Team October 23, 2005 08:16 AM UTC

Here is a sample with that code working. http://www.syncfusion.com/Support/user/uploads/GGC_Nested_82eae08f.zip Check to make sure you are using the proper string ("ChildToGrandChild") in the GetTableControl call. It should be the relation name.


KM KMS October 23, 2005 04:38 PM UTC

I''m getting a "page not found" error on the sample zip file. >Here is a sample with that code working. > >http://www.syncfusion.com/Support/user/uploads/GGC_Nested_82eae08f.zip > >Check to make sure you are using the proper string ("ChildToGrandChild") in the GetTableControl call. It should be the relation name.


AD Administrator Syncfusion Team October 24, 2005 12:35 AM UTC

Try this link. http://www.syncfusion.com/Support/user/uploads/GGC_Nested_ab3e4c28.zip

Loader.
Live Chat Icon For mobile
Up arrow icon