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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Is there an equivalent to the ADO.NETdataTable.Select("expression") method at the ggc level

Thread ID:

Created:

Updated:

Platform:

Replies:

55243 Jan 25,2007 03:55 PM UTC Feb 6,2007 05:59 PM UTC WinForms 5
loading
Tags: Grouping
James Blibo
Asked On January 25, 2007 03:55 PM UTC

I am trying to mimick the DataTable.Select("Col1=1 and Col2='b'") method at the ggc level.

I want to select a group a records that meets a certain criteria without setting a filter on the ggc and then take some action on those records, for example, delete those records. How can I accomplish that?

I want to do something like...

RecordsInDetailsCollection recs = this.gridGroupingControl1.....

foreach(Record rec in recs)
rec.Delete();

Administrator [Syncfusion]
Replied On January 29, 2007 09:29 AM UTC

Hi James,

Thanks for being patience.

This can be achieved by using the GridConditionalFormatDescriptor and deleting the records based on the condition. The following is the code snippet, please try it and let us know if you need any further assistance.
>>>>>>>>>>>>>>>>>>Code Snippet <<<<<<<<<<<<<<<<<<<<
GridConditionalFormatDescriptor desc = new GridConditionalFormatDescriptor();
desc.Expression = "[CustomerID] LIKE 'A*'";

this.gridGroupingControl1.TableDescriptor.ConditionalFormats.Add(desc);
foreach (Record rec in this.gridGroupingControl1.Table.Records)
if (desc.CompareRecord(rec))
rec.Delete();
>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<

Please refer to the following sample for more details
CondnlFormatDesc.zip

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan

James Blibo
Replied On January 29, 2007 04:09 PM UTC

DO I have to iterate thru all the records again to do a comparison before I delete. If I have a thousand records, that'll be too much.

I want to do something like...

DataRow[] rows = DataTable.Select("Name LIKE 'A*'");

foreach(DataRow row in rows)
row.Delete();

Administrator [Syncfusion]
Replied On January 30, 2007 12:49 PM UTC

Hi James,

Thank you for being patience.

Please try the following technique, a filter condition is applied to the grid and it will be reset after the records being deleted. Please refer to the following code snippet and let us know if you need any further assistance.

>>>>>>>>>>>>>>>>>>>>>>>>>>> this.gridGroupingControl1.TableDescriptor.RecordFilters.Add("[CustomerID] LIKE 'A*'");
FilteredRecordsInTableCollection reco = this.gridGroupingControl1.Table.FilteredRecords;
foreach (Record r in reco)
r.Delete();
this.gridGroupingControl1.TableDescriptor.ResetRecordFilters();
>>>>>>>>>>>>>>>>>>>>>>>>>>>

Have a nice day.

Best regards,
Madhan

James Blibo
Replied On February 5, 2007 06:24 PM UTC

The only problem with this is that I have the grid visible, so the user will see the filter being applied in front of them and will be like... "where did the other records go?".

Is there are way that I apply the filter to get the records but not have the filter appied in the UI

James Blibo
Replied On February 6, 2007 05:59 PM UTC

Any suggestion on how to go about this?

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.

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

;