2011-05-19 32 views
1

我有一個從設計的sql數據源定義的gridview,我已經配置sqldatasource選擇,更新和刪除,我有一個標題字段在我的表是主鍵,它工作正常,並更新記錄。直到我刪除了boundfields並放置了templatefield和itemtemplate。從那以後,我得到一個錯誤說:gridview和sqldatasource控制在asp.net

You have specified that your update command compares all values on SqlDataSource 'SqlDataSource1', but the dictionary passed in for oldValues is empty. Pass in a valid dictionary for update or change your mode to OverwriteChanges.

,如果我做ConflictDetection =「OverwriteChanges」它工作正常,但不更新.. 的ItemTemplate中的要求,是因爲我想顯示頁腳模板新記錄和更改默認的編輯和刪除按鈕的ImageButton ...

我應該如何使它工作使用的ItemTemplate ...

+1

我們可以看到一些代碼嗎? – gbs 2011-05-19 23:20:41

回答

1

,你可以將它們添加到GridView的DataKeyNames集合添加要堅持列。