Error selecting first index item in a radgrid

Posted by Jopito under ASP.NET on 1/13/2014 | Points: 10 | Views : 1060 | Status : [Member] | Replies : 0
Hellow pals,i have a problem whereby when i select a row on a radgrid ,i get the following error below.Sometimes i do select and i dont get the error. Is their a way to solve this issue?Below is the error


Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Source Error:


Line 35: {
Line 36:
Line 37: GridDataItem selectedRow = RadgridStudents.SelectedItems[0] as GridDataItem;
Line 38: string id = selectedRow.GetDataKeyValue("StudentId").ToString();
Line 39: Session["StudentId"] =id;


Mark as answer if satisfied


Responses

(No response found.)

Login to post response