Gridview row selection [Resolved]

Posted by Writetopallavi under ASP.NET on 6/12/2012 | Points: 10 | Views : 1669 | Status : [Member] | Replies : 1
Hi all

I have a gridview filled with data & a delete button (outside the grid)
when i click on delete button a gridview row should get deleted
for that i need to check which row of grid user has selected
so i used the code as below

GridDataItem selectedItem = (GridDataItem)RadGrid1.SelectedItems[0];

but what if user click on delete button without selecting the row of gridview
what validation should i apply for that

at the above coeline error occurs saying that Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index


Posted by: Peermohamedmydeen on: 6/12/2012 [Member] Bronze | Points: 50


Check the selected items count. If it is equal to zero through a validation message out.

Writetopallavi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response