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.
Unfortunately, activation email could not send to your email. Please try again.

Undo Deletion of a Record

Thread ID:

Created:

Updated:

Platform:

Replies:

127530 Nov 21,2016 11:19 AM Nov 22,2016 12:46 AM Windows Forms 1
loading
Tags: GridGroupingControl
Swetaketu Majumder
Asked On November 21, 2016 11:19 AM

Hi,

I want to create an option to 'undo' a deletion from the grid. I saw in the documentation that I can easily delete record(s) using this.gridGroupingControl1.Table.Records.DeleteRecords(rec); But is there a way to 'undo' it?

Alternatively, is there a way to hide/unhide selected records from the grid grouping control?

Thanks,
Swetaketu

Piruthiviraj Malaimelraj [Syncfusion]
Replied On November 22, 2016 12:46 AM

Hi Swetaketu, 

Thanks for your interest in Syncfusion products. 

We have analyzed your scenario and created the simple sample as per your requirement. In order to hide/unhide the records of grid, AddRange/Remove methods of RowHiddenEntries can be used. Please make use of the below code, 
 
Code example: 
void chk_hide_CheckStateChanged(object sender, EventArgs e) 
{ 
    GridRowHidden[] hiddenrows; 
    if (chk_hide.Checked) 
    { 
        int n = this.gridGroupingControl1.Table.SelectedRecords.Count; 
        int rowIndex; 
        hiddenrows = new GridRowHidden[n]; 
        for (int i = 0; i < n; i++) 
        { 
            rowIndex = this.gridGroupingControl1.Table.SelectedRecords[i].Record.GetRowIndex(); 
            hiddenrows[i] = new GridRowHidden(rowIndex); 
        } 
        //Hide the selected rows. 
        this.gridGroupingControl1.TableControl.Model.RowHiddenEntries.AddRange(hiddenrows); 
    } 
    else 
    { 
        //Unhide the selected rows. 
        while (this.gridGroupingControl1.TableControl.Model.RowHiddenEntries.Count > 0) 
        { 
            this.gridGroupingControl1.TableControl.Model.RowHiddenEntries.Remove(this.gridGroupingControl1.TableControl.Model.RowHiddenEntries[0]); 
        } 
    } 
} 
 
Sample link: 

Please refer the below KB for further references, 

Regards, 
Piruthiviraj

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.

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.

;