AspxGridview 更新行默认值
我有一个 devXpress Gridview,并且有一个编辑特定行的功能。我有两列,名为“dateModified”和“modifiedBy”。我希望每当有人单击“编辑”按钮时它都会自动用当前日期和用户填充这两个字段。有没有办法在客户端代码中执行此操作?
这是我到目前为止所得到的,但它似乎没有达到我想要的效果:
Protected Sub ASPxGridView1_UpdateRow(ByVal sender As Object, ByVal e As DevExpress.Web.Data.ASPxStartRowEditingEventArgs) Handles grid.StartRowEditing
Dim currentTime As Date = System.DateTime.Today
e.EditingKeyValue("date_modified") = Format(currentTime, "MM/dd/yyyy")
e.EditingKeyValue("modified_by") = Environment.UserName
End Sub
当我测试它时,它给了我这个错误:
找不到该类型的默认成员
关于如何在用户编辑时显示默认值有什么想法吗?
更新:已修复,解决方案见下文
I have a devXpress Gridview and there's a functionality to edit specific rows. I have two columns called "dateModified" and "modifiedBy". I want it to automatically populate those two fields with the current date and user whenever somebody clicks the "edit" button. Is there a way to do this in the client code?
This is what I got so far but it doesn't seem to do what I want:
Protected Sub ASPxGridView1_UpdateRow(ByVal sender As Object, ByVal e As DevExpress.Web.Data.ASPxStartRowEditingEventArgs) Handles grid.StartRowEditing
Dim currentTime As Date = System.DateTime.Today
e.EditingKeyValue("date_modified") = Format(currentTime, "MM/dd/yyyy")
e.EditingKeyValue("modified_by") = Environment.UserName
End Sub
When I tested it, it gave me this error:
No default member found for type
Any ideas on how I can get the default values to show up when the user is editing?
Update: Fixed, see below for solution
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于遇到此问题的其他人,以下是使其正常工作的方法:
For anyone else having this problem, this is how to get it to work: