【问题标题】:Log row update in GridViewGridView 中的日志行更新
【发布时间】:2013-09-28 15:38:52
【问题描述】:

我有默认更新和选择列的 asp.net 网格视图(它们不会转换为模板列)

现在我想记录用户何时更新一行(我在表中有一个列:userlog 可以在网格视图中显示,但它是只读的)

我尝试在 GridView_RowUpdated 事件中编写自己的更新语句 但我没有把事情做完,我想附加登录的用户 ID,用 日期邮戳,在用户日志列中现有值的末尾

请帮忙,目前我正在 RowUpdated 事件中执行以下操作:

string sqlEL = "Select userlog from Schedule Where rowid=" + e.Keys[0].ToString();
        string tmp = dao.GetSingle(sqlEL);
        if (tmp == null || tmp == String.Empty)
            tmp = ".";
        string sqlUp = "Update Schedule set userlog='" + tmp + "' + '"
        + LogthisUser() + "' Where rowid=" + e.Keys[0].ToString();
        dao.UpdateDB(sqlUp);

【问题讨论】:

    标签: asp.net gridview


    【解决方案1】:

    这是因为 readonly 列是一个简单的绑定字段 在 Asp.Net 中,如果你想在编辑模式下限制列值,仍然显示它 在普通视图中给用户,那么它必须是模板字段,带有EditItemTemplate 被移除

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-04
      • 1970-01-01
      相关资源
      最近更新 更多