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

Delete records in selected range from the datasource

i am able to retrieve a list of selected records in a GGC via: Me.ggc.TableModel.SelectedRanges i used: Me.ggc.TableModel.Rows.RemoveRange() but apparently it only unselect the selected rows. how do i delete the records from the ggc instead of unselecting?

4 Replies

AD Administrator Syncfusion Team January 5, 2005 03:00 AM

You can try using this.gridGroupingControl1.Table.DeleteRecord Or, you can work directly with your datasource and use methods on it to delete its records. With the 3010 code base, if you use the new record selection support, this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended; this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.None; then this button handler will delete the selected records.
private void button2_Click(object sender, System.EventArgs e)
{
	foreach(SelectedRecord r in this.gridGroupingControl1.Table.SelectedRecords)
		this.gridGroupingControl1.Table.DeleteRecord(r.Record);
	
}


LA Lance January 5, 2005 11:01 PM

i am currently developing in 2109. i tried to use this.gridGroupingControl1.Table.DeleteRecord. however, how do i retrieve a list of selected records from the ggc? thanks.


AD Administrator Syncfusion Team January 6, 2005 03:23 AM

You can try code like this.
private void button2_Click(object sender, System.EventArgs e)
{
	ArrayList recs = new ArrayList();
	foreach(GridRangeInfo r in this.gridGroupingControl1.TableModel.Selections.GetSelectedRows(true, false))
	{
		for(int row = r.Top; row <= r.Bottom; ++row)
		{
			GridTableCellStyleInfo style = this.gridGroupingControl1.TableModel[row, 1];
			GridRecordRow rr = style.TableCellIdentity.DisplayElement as GridRecordRow;
			if(rr.ParentRecord != null)
				recs.Add(rr.ParentRecord );
		}
	}

	foreach(Record rec in recs)
		this.gridGroupingControl1.Table.DeleteRecord(rec);
}


LA Lance January 6, 2005 09:22 AM

cool! the codes work great! however, it seem pretty tough to find out what methods/properties to use in order to achieve what i want...

Loader.
Live Chat Icon For mobile
Up arrow icon