Server Error in '/' Application.
--------------------------------------------------------------------------------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
怎么解决这个错误??????????????????????????????
请各位高手写出详细解决方法,谢谢!!!!

解决方案 »

  1.   

    Line 26: dim sql3="update content set clname='" & request.Cookies("mycookies")("name") & "' where "& mydatagrid.DataKeyField & "=" & mydatagrid.datakeys(e.item.itemindex) 
    这是他提示错误的行
      

  2.   

    Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
    应该是index超出范围吧
      

  3.   

    应该是mydatagrid.datakeys(e.item.itemindex) 的问题,
    看你的错误提示,只有可能是这里出问题,datakeys(index)超出范围了,
    你仔细检查一下!!
      

  4.   

    如果是用vs.net开发的话,设置一个断点,跟踪一下mydatagrid.datakeys(e.item.itemindex),是索引越界了,如果这一列已经被删除了就会出现这种问题。
      

  5.   

    在DataGrid中必须定义: DataKeyField="id"