Skip to main content

How to: Delete Selected Rows

  • 2 minutes to read

The example illustrates how to delete selected rows of the ASPxGridView bound to an in-memory data source.

See Also:

View Example

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