【问题标题】:gridview and sqldatasource control in asp.netasp.net中的gridview和sqldatasource控件
【发布时间】:2011-05-19 20:43:44
【问题描述】:

我有一个从设计时定义的 sql 数据源填充的 gridview,我已经将 sqldatasource 配置为选择、更新和删除,我的表中有一个标题字段,它是主键,它工作正常并且也更新了记录.直到我删除了boundfields并放置了templatefield和itemtemplate。之后我收到一条错误消息:

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 使其工作...

【问题讨论】:

    标签: asp.net gridview sqldatasource


    【解决方案1】:

    您可以通过将要保留的列添加到 gridview datakeynames 集合来添加它们。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-05
      • 2017-09-15
      • 2013-07-25
      • 1970-01-01
      • 1970-01-01
      • 2011-10-08
      • 2012-10-26
      • 2010-09-22
      相关资源
      最近更新 更多