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

GridGroupingControl: Remove row button.

Hello. How to implement remove row button on the form. Just to delete currently selected row by pressing this button. Thank you.

3 Replies

AD Administrator Syncfusion Team June 23, 2004 08:40 AM UTC

You can Record.Delete to remove a record from a GridGrouping control. So, for example, to delete the current record in a GridGroupingControl, you could use code like
private void button1_Click(object sender, EventArgs e)
{
	Record r = this.gridGroupingControl1.Table.CurrentRecord;
	if(r != null)
	{
		r.Delete();
	}
}


GS Gerald Stedile August 4, 2004 01:37 PM UTC

Hi Clay, I am actually using some code like this. The only difference is, that I do not only delete the current row, but loop over all the existing rows to delete them. If there is more than one row in the list I get an Exception from the GridGroupingControl when deleting the first row. Is there some known workaround ? Greetings, Gary


AD Administrator Syncfusion Team August 4, 2004 03:33 PM UTC

I tried this code by clicking on the last line an dthen clicking th ebutton. It deleted everything for me using 2.0.5.1.
private void button1_Click(object sender, System.EventArgs e)
{
	Record r = this.gridGroupingControl1.Table.CurrentRecord;
	while(r != null)
	{
		r.Delete();
	this.gridGroupingControl1.Table.TableDirty = true;
	this.gridGroupingControl1.Refresh();
	r = this.gridGroupingControl1.Table.CurrentRecord; 
	}
}

Loader.
Up arrow icon