Posted on: 8/24/2013 2:56:14 AM | Views : 778

I am using Visual studio 2010, targeting 3.5 framework with MySQL database as the backend.
My gridview loads fine, I click the 'Edit' link and it allows me to edit.  Once I hit the 'Update' link I keep getting the following error, "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"
The line it  points to is in gvCourses_RowUpdating --> Dim iCourseID As Integer = Int32.Parse(gvCourses.DataKeys(e.RowIndex).Value.ToString)
Below is the code I am using.   Does anyone know see why I keep getting this?
Html code
<asp:GridView ID="gvCourses" runat="server" AutoGenerateColumns="false" DataKeyNames="course_id" HeaderStyle-CssClass="dgStyle" OnPageIndexChanging="gvCourses_PageIndexChanging" OnPageIndexChanged="gvCourses_Pag ...

Go to the complete details ...