How to: Delete Selected Rows

  • 2 min to read

The example illustrates how to delete selected rows of the ASPxGridView bound with an in-memory DataSource.See Also:How to move selected rows from the ASPxGridView into another ASPxGridViewEditing an in-memory dataset

protected void gridView_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) {
    if(e.Parameters == "Delete") {
        table = GetTable();
        List<Object> selectItems = grid.GetSelectedFieldValues("ID");
        foreach(object selectItemId in selectItems) {
            table.Rows.Remove(table.Rows.Find(selectItemId));
        }
        grid.DataBind();
        grid.Selection.UnselectAll();
    }
}