This is a migrated thread and some comments may be shown as answers.

delete row?

2 Answers 330 Views
GridView
This is a migrated thread and some comments may be shown as answers.
yarik
Top achievements
Rank 1
yarik asked on 22 Aug 2007, 02:21 PM
I want to delete row. How can i do this??

2 Answers, 1 is accepted

Sort by
0
yarik
Top achievements
Rank 1
answered on 22 Aug 2007, 02:41 PM

Also I find new bug. When I delete row (dg.Rows.RemoveAt(i)) and I have only one row, popup exeption "Index was out of range. Must be non-negative and less than the size of the collection Parameter name: index " 

0
Jack
Telerik team
answered on 22 Aug 2007, 04:18 PM
Hi yarik,

You can delete a row from RadGridView by using Remove and RemoveAt functions of RadGridView.Rows collection. See this sample code:

this.radGridView1.Rows.Remove(this.radGridView1.Rows[2]);
this.radGridView1.Rows.RemoveAt(2);


As to your second post: You must check that your parameters are correct, otherwise you will receive an exception. Maybe the variable you used to pass as index parameter for RemoveAt function is incorrect and outside the bounds of the Rows collection. Please,check this and let us know if this was the root of the problem.
 

Best wishes,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
yarik
Top achievements
Rank 1
Answers by
yarik
Top achievements
Rank 1
Jack
Telerik team
Share this question
or