Edit this page

Removing Rows

In order to remove a single row from RadGridView, you should simply call the the Remove method and pass an object of type GridViewDataRowInfo as an argument.

Remove Row

this.radGridView1.Rows.Remove(rowToRemove);

Me.RadGridView1.Rows.Remove(rowToRemove)

If you want to remove a row at a specific position, call RemoveAt method and pass the row index.

Remove Row With Index

this.radGridView1.Rows.RemoveAt(0);

Me.RadGridView1.Rows.RemoveAt(0)

As to removing all rows, make a loop and remove the rows with the RemoveAt method. Note: If your RadGridView is bound to a BindingList, the BindingList will be updated automatically. However, if RadGridView is bound to data set, you should call the Update method. Here is an example with the NorthWind data set and its carsTableAdapter

Update Adapter

this.carsTableAdapter.Update(this.nwindDataSet.Cars);

Me.CarsTableAdapter.Update(Me.NwindDataSet.Cars)

An alternative to removing all the rows would be to use the Clear method of the Rows collection as it will be a more efficient solution since the grid's events will be suspended and you will write less code:

Clearing Rows

this.radGridView1.Rows.Clear();

Me.RadGridView1.Rows.Clear()

See Also