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

GGC 7.403.0.20 - How to refresh GGC when style of cell is updated

Hi:

I update cell style in a function but GGC does not display updated style. How can I refresh GGC to display updated style?

private void ValidateDeviceIpAddress()
{
foreach (Record record in gridGroupingControl.Table.Records)
{
var device = (NetworkDevice)record.GetData();
if (device.IpAddress != null)
{
GridTableCellStyleInfo ipAddressStyle = GridGroupingControl.Table.GetTableCellStyle(record, IP_ADDRESS_STR);

ipAddressStyle.CellTipText = "error";
ipAddressStyle.Tag = "error";
}
}
}

Thank you.
Bina

3 Replies

RC Rajadurai C Syncfusion Team April 21, 2010 09:04 AM UTC

Hi Bina,

Thanks for your interest in Syncfusion Products.

In GridGroupingControl, the styles can be applied only through two ways:
1) TableDescriptor,
2) Handling QueryCellStyleInfo/PrepareViewStyleInfo event.

To set styles column-wise in grid, TableDescriptor can be used. Here is an example code for your reference.

this.gridGroupingControl1.TableDescriptor.Columns["Mark"].Appearance.AnyRecordFieldCell.CellTipText = "Error";


To set styles for individual cells based on condition, you need to handle some thing like the below code in QueryCellStyleInfo event.

if (e.TableCellIdentity.TableCellType == Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellType.AlternateRecordFieldCell)
{
if (e.TableCellIdentity.Column.Name == "Mark")
{
if (int.Parse(e.Style.Text) > 60)
{
e.Style.CellTipText = "PASS";
e.Style.Tag = "PASS";
}
}
}

Here is a sample for your reference.
http://help.syncfusion.com/support/samples/Grid.Windows/7.4.0.20/F94039.zip

Regards,
Rajadurai


BT Bina Thakkar April 22, 2010 03:32 PM UTC

Hi:

How can I make sure that GGC's QueryCellStyleInfo method is invoked when I am not changing any GGC content. In the case above, I have other user controls outside of GGC and I want to validate GGC's cell content,change cell style and refresh GGC with updated style.
1) How can I refresh GGC to display modified style outside QueryCellStyleInfo?
or
2)How can invoke GGC's QueryCellStyleInfo when I am not changing contents of GGC?

Thank you.
Bina


CI Christopher Issac Sunder K Syncfusion Team April 28, 2010 11:56 AM UTC

Hi Bina,

Thanks for your update.

You can invoke the QueryCellStyleInfo event wherever you need. To achieve this you can use a flag variable to differentiate it from one action to another.
Here I use two buttons which holds a different style ((i.e) tooltip) invokes the same QueryCellStyleInfo event in their click event.

Style Settings can be applied to different grid elements dynamically at run time. This can be achieved by proper handling of the QueryCellStyleInfo event. It provides the GridStyleInfo object for a cell on demand.

QueryCellStyleInfo is raised every time a request is made to access the style information for a cell. You can do any type of formatting cells with this event. It accepts GridTableCellStyleInfoEventArgs as one of its parameters which can be used to customize the cells of the grouping grid control.

Please refer the sample link which deals with the multiple usage of QueryCellStyleInfo event.

http://help.syncfusion.com/support/samples/Grid.Windows/8.2.0.18/F94039a.zip

Please let me know if you have any further concerns.

Regards,

Christopher K.

Loader.
Live Chat Icon For mobile
Up arrow icon