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

Delete records in selected range from the datasource

Thread ID:

Created:

Updated:

Platform:

Replies:

23104 Jan 5,2005 05:18 AM UTC Jan 6,2005 02:22 PM UTC WinForms 4
loading
Tags: Grouping
Lance
Asked On January 5, 2005 05:18 AM UTC

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?

Administrator [Syncfusion]
Replied On January 5, 2005 08:00 AM UTC

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);
	
}

Lance
Replied On January 6, 2005 04:01 AM UTC

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.

Administrator [Syncfusion]
Replied On January 6, 2005 08:23 AM UTC

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);
}

Lance
Replied On January 6, 2005 02:22 PM UTC

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...

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

;