1. 程式人生 > >DataGrid儲存資料時出現錯誤解決辦法.

DataGrid儲存資料時出現錯誤解決辦法.

解決辦法:
前臺設定DataGrid
DataKeyField="ID"

錯誤提示:


Server Error in '/News' 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

Source Error:

Line 93: 		{
Line 94: //取得編輯行的關鍵欄位的值
Line 96:
Line 97: //取得文字框中輸入的內容

Source File:
e:/aspxproject/news/datagridedit.aspx.cs    Line: 95