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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Finding Rows and their summaries

Thread ID:





24796 Feb 10,2005 09:30 PM UTC Feb 11,2005 09:09 PM UTC WinForms 1
Tags: Grouping
Anthony Avella
Asked On February 10, 2005 09:30 PM UTC

I''m currently implementing the following code to find detail records meeting certain criteria and adding the rows to the grid''s selected records (this code came from you guys in these forums - thx): foreach(Record r in grid.Table.Records) { strCellValue = r.GetValue(strFilterColumn).ToString(); if(strCellValue == textFindValue) { if(!grid.Table.SelectedRecords.Contains(r)) { grid.Table.SelectedRecords.Add(r); } }//end if(strCellValue == strFilterText) }//end foreach Now my requirements have changed. When I find the first record that meets the criteria passed in, I may need to highlight that detail row''s summary row. I would need to do this if the column (strFilterColumn) is what the detail record''s summary column''s category is. For example: My grid is grouped by column X. I need to find the first record where X = "ABC". When I locate the first record, I need to find that detail record''s summary row. If the grid''s lowest group by category equals the find column (column X in this example), I need to highlight that summary row or add it to the grid.Table.SelectedRecords collection. In addition, I need to be able to allow a user to find the next instance and repeat the cyle above in an interactive way. Thanks

Administrator [Syncfusion]
Replied On February 11, 2005 09:09 PM UTC

Anthony, Based on earlier conversations I assume you have custom GroupingEngine where you override Group and you use summaries in captions. When you find a record you can set a flag in the parent group indicatting that a detail row meets the criteria. Then you override QueryCellStyleInfo and in that event handler you check if a summary row is queried. In that case you can check the parent group whether the mentioned flag was set and in that case change the backcolor of the summary row. Code: - Getting the parent group, e.g. when your Group group = record.ParentGroup; if (group is MyCustomGroup) ((MyCustomGroup) group).HighlightSummary = true; else if (group is MyCustomChildTable) ((MyCustomChildTable) group).HighlightSummary = true; In your MyCustomGroup and MyCustomChildTable classes you add a HighlightSummary flag. A QueryCellInfo overide can look like this: private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { Element el = e.TableCellIdentity.DisplayElement; if (el is CaptionRow) { bool highlight = false; Group group = el.ParentGroup; if (group is MyCustomGroup) highlight = ((MyCustomGroup) group).HighlightSummary; else if (group is MyCustomChildTable) highlight = ((MyCustomChildTable) group).HighlightSummary; if (highlight && e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell) { e.Style.BackColor = Color.Red; // your highlight color } } } Stefan


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon