2011-05-19 69 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集合添加要坚持列。