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

How to remove Selected Rows from GridGrouping Control?

I want to remvoe selected rows from gridgrouping control. I need the C# Code for that. I used earlier codes given in this forum for the same but none of them worked. My Datasource for this gridgrouping control is Array List. Thanks


6 Replies

JJ Jisha Joy Syncfusion Team January 2, 2009 05:58 AM UTC

Hi Vignesh,

The following code snippet helps you to remove the selected records from the GridGroupingControl. Please try it and let us know if you need any further assistance.

Syncfusion.Grouping.SelectedRecordsCollection selRecords;
selRecords = this.gridGroupingControl1.Table.SelectedRecords;
foreach(Syncfusion.Grouping.SelectedRecord record in selRecords)
{
record.Record.Delete();
}


Also refer to the following forum thread for more details on this issue
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=36978

Regards,
Jisha



AD Administrator Syncfusion Team January 2, 2009 06:57 AM UTC

Basically After using this code what happenes is still not data are removed from the grid. but If i Select the row then on the selected row i see values of the row following next to it. I am missing few properties i guess. I tried using Beginedit and End edit but that did not gave results.
>Hi Vignesh,

The following code snippet helps you to remove the selected records from the GridGroupingControl. Please try it and let us know if you need any further assistance.

Syncfusion.Grouping.SelectedRecordsCollection selRecords;
selRecords = this.gridGroupingControl1.Table.SelectedRecords;
foreach(Syncfusion.Grouping.SelectedRecord record in selRecords)
{
record.Record.Delete();
}


Also refer to the following forum thread for more details on this issue
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=36978

Regards,
Jisha





AD Administrator Syncfusion Team January 2, 2009 07:02 AM UTC


Has This problem of data source not getting refreshed to do with Array List?

My data source is of type Array List.



AD Administrator Syncfusion Team January 2, 2009 09:29 AM UTC

Okay I have added this code finally.
this.gridGroupingControl1.Engine.Table.TableDirty = true;
So the problem of row not removing is solved But a new bug I have seen is that If i remove rows 1,2,3 then Rows 2,5,6 etc. i.e. rows which were not selected are deleted. at runtime values inside the records is changing when we start deleting rows in a loop. How can we stop this happening?





AD Administrator Syncfusion Team January 2, 2009 09:43 AM UTC


Okay I have came up with the solution itself.

You can use the following code to remove selected rows from a GRID GROUPING CONTROL.

Syncfusion.Grouping.SelectedRecordsCollection selRecords;
selRecords = this.gridGroupingControl1.Table.SelectedRecords;
Syncfusion.Grouping.Record[] r = new Record[count];
selRecords.CopyTo(r, 0);
this.gridGroupingControl1.Table.SelectedRecords.Clear();

this.gridGroupingControl1.Engine.Table.BeginEdit();

for (int i = count - 1; i >= 0; i--)
{
this.gridGroupingControl1.Table.DeleteRecord(r[i]);
}


this.gridGroupingControl1.Engine.Table.EndEdit();
this.gridGroupingControl1.Engine.Table.TableDirty = true;
this.gridGroupingControl1.Update();

The idea for going to delete records in a reverse direction is that even if records change we will always ensure that correct selected row is deleted.
Thank you.



JJ Jisha Joy Syncfusion Team January 6, 2009 07:29 AM UTC

Hi Vignesh,

Glad to hear that issue has been solved. Thank you for sharing information with us.

Regards,
Jisha


Loader.
Live Chat Icon For mobile
Up arrow icon