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?
SIGN IN To post a reply.
4 Replies
AD
Administrator
Syncfusion Team
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);
}
LA
Lance
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.
AD
Administrator
Syncfusion Team
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);
}
LA
Lance
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...
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
LA Lance
- Jan 5, 2005 05:18 AM UTC
- Jan 6, 2005 02:22 PM UTC