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.

GGCproblem Urgent

Thread ID:

Created:

Updated:

Platform:

Replies:

42181 Mar 22,2006 01:16 AM Mar 23,2006 07:28 AM Windows Forms 4
loading
Tags: GridControl
resmi
Asked On March 22, 2006 01:16 AM

hi Iam using GGC.Iwant to change the backcolor of some records of the grid .ie,based on a condition.But for a grid without any child tables it is working.But ifthe grid have some childtables & some of the grid have filterbars.,some have addnewrecords,.. this is not working correctly.I want to create a generic function to check this for the parent & child ones.ie if my condition is true,I want that record to be gray in color. Now iam using this code private void grid1_TableControlPrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlPrepareViewStyleInfoEventArgs e) { if(e.Inner.RowIndex > 2 && e.Inner.ColIndex > 0) { if(this.gridUOMTye.TableModel.Model[e.Inner.RowIndex,3].CellType=="CheckBox") { object o = this.gridUOMTye.TableModel.Model[e.Inner.RowIndex,3].CellValue; if(o!=null) { bool val = o.ToString() == true.ToString(); if(val) { e.Inner.Style.CellType="Static"; e.Inner.Style.BackColor = Color.LightGray; } } } } Can anybody solve this problem?

Administrator [Syncfusion]
Replied On March 22, 2006 02:16 AM

Hi, The GridConditionalFormatDescriptor can be used to format a row conditionally, without handling any events. Please refer to the attached sample and let us know if this servers your need. Regards, Calvin.

42181.zip

Administrator [Syncfusion]
Replied On March 22, 2006 02:33 AM

Hi, In the previous sample please add the fd.Appearance.RecordPlusMinusCell.CellType = "PushButton"; after setting fd.Appearance.AnyRecordFieldCell.CellType = "Static"; which will avoid the RecordPlusMinusCell cell from changing into Static cell type. Bellow is a code snippet. GridTableDescriptor gtd = this.gridGroupingControl1.GetTableDescriptor("ParentTable"); GridConditionalFormatDescriptor fd = new GridConditionalFormatDescriptor("ColorMe"); fd.Expression = "[parentID] = 1"; fd.Appearance.AnyRecordFieldCell.CellType = "Static"; fd.Appearance.RecordPlusMinusCell.CellType = "PushButton"; fd.Appearance.AnyRecordFieldCell.BackColor = Color.LightGray; gtd.ConditionalFormats.Add(fd); gtd = this.gridGroupingControl1.GetTableDescriptor("ChildTable"); fd = new GridConditionalFormatDescriptor("ColorMe"); fd.Expression = "[childID] = 1"; fd.Appearance.AnyRecordFieldCell.CellType = "Static"; fd.Appearance.RecordPlusMinusCell.CellType = "PushButton"; fd.Appearance.AnyRecordFieldCell.BackColor = Color.LightGray; gtd.ConditionalFormats.Add(fd); gtd = this.gridGroupingControl1.GetTableDescriptor("GrandChildTable"); fd = new GridConditionalFormatDescriptor("ColorMe"); fd.Expression = "[GrandChildID] LIKE ''1*''"; fd.Appearance.AnyRecordFieldCell.CellType = "Static"; fd.Appearance.RecordPlusMinusCell.CellType = "PushButton"; fd.Appearance.AnyRecordFieldCell.BackColor = Color.LightGray; gtd.ConditionalFormats.Add(fd); Regards, Calvin.

resmi
Replied On March 22, 2006 10:30 PM

Sorry .This will not work for my case.In my problem the condition which iam saying is not a field or column of the grid.Based on some other condition ,I''ve to change the back ground . Can you give a solution

Administrator [Syncfusion]
Replied On March 23, 2006 07:28 AM

Hi, I am not sure about the condition that you are checking to set a back color of a row. To use the TableModel for a nested table in a GridGroupingControl this.gridGroupingControl1.GetTableModel(tableName)[e.Inner.RowIndex, e.Inner.RowIndex]must be used. But to set the styles for rows dynamically the QueryCellStyleInfo event would be the best. Please refer to the attached sample. Regards, Calvin.

421810.zip

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.

;