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.

When looping thru ggc.Table.Records, how can I tell that a records meets my Conditional Format Descriptor

Thread ID:

Created:

Updated:

Platform:

Replies:

67447 Aug 18,2007 06:43 AM Aug 20,2007 02:53 AM Windows Forms 1
loading
Tags: Grouping
James Blibo
Asked On August 18, 2007 06:43 AM

I have a ggc in which I have define a GridConditional format to to disabledenable the row based on a certain conditions like...

...Appearance.AnyRecordCell.Enabled = false;


when manually looping thru the record of the gggc that I obtained by ggc.Table.Records, how can I tell if the UI row that this record is bounded to is disabled or enabled, in other words, meets the condition of the Conditional format.

Jeba S [Syncfusion]
Replied On August 20, 2007 02:53 AM

Hi James,

Thank you for your details.

The grid has no collection of records that satisfy a particular conditional format. The formatting for conditional formatting is determined

on demand as the record is drawn in the grid.

So, if you want a collection of such records, then you would have to loop through all the current records in the grid and check the

GridTableViewStyle to see if that particular record has the style applied to it.

Please refer the steps that show how this can be done.

1) This code sets up the formatting and additionally, puts a 1 in the Tag field of the row header cell.

GridConditionalFormatDescriptor gcfd = new GridConditionalFormatDescriptor();
gcfd.Expression = "[Col1] > [Col2]";
gcfd.Appearance.AnyRecordFieldCell.Enabled = false;
gcfd.Appearance.AnyCell.BackColor = Color.Red;
gcfd.Appearance.RowHeaderCell.Tag = 1; //mark the header cell
this.gridGroupingControl1.TableDescriptor.ConditionalFormats.Add(gcfd);


2) Here is a button handler that loops through all records in the grid to test whether this "1" value is set in the header cell. It simply

points a particular field value in a listbox, but you could create an List or ArrayList of records that satisfy the filter.

private void button1_Click(object sender, EventArgs e)
{
foreach (GridRecord rec in gridGroupingControl1.Table.FilteredRecords)
{
int rowIndex = gridGroupingControl1.Table.DisplayElements.IndexOf(rec);
GridTableCellStyleInfo style = gridGroupingControl1.TableControl.GetTableViewStyleInfo(rowIndex, 0); //0 is row header
if (style.Tag != null && style.Tag.Equals(1))
{
listBox1.Items.Add(rec.GetValue("Col0"));
}
}
}

Please refer the sample which implements the above said feature:
http://websamples.syncfusion.com/samples/Grid.Windows/F67447/main.htm

Kindly let us know if you need any further assistance.

Thank you for using Syncfusion Products.

Best Regards,
Jeba.

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.

;