IN the telerik radgrid, I want to delete the 4th row of the grid but it's not working. It throws an error Argument out of exception
.
I got 4 rows and the first 2 rows has some values...so i want to delete the other 2 rows which are empty but it's not working.
Try 1:
radGridView2.Rows.Remove(radGridView2.Rows[3]);
Try 2:
radGridView1.Rows.RemoveAt(3);
The radgrid code:
private const int Test = 4;
private void SetDataGridView()
{
for (var rowCount = 0; rowCount < Test; rowCount++)
{
radGridView1.Rows.Add(string.Empty);
}
}
You can try to remove it from the datasource and then call databind in order to bind wit new DataSource.
Delete on DataTable
YourDataTable.Rows.Remove(YourRow);
So you can create with
int count = YourControl.Rows.Count;
for (int i = 0; i <= count; i++)
{
if (condition) //You can adjust your condition, for example i == 0
{
YourControl.DeleteRow(i);
}
}