在详细信息视图中更新日期时间列 [英] Update datetime column in detail view
本文介绍了在详细信息视图中更新日期时间列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
修改行后,尝试更新详细信息视图中的datetime列,有任何建议吗?
包含数据列(包括日期时间和用户列)的Details视图.每当执行修改时,用户ID和日期时间库林都需要用用户ID和更新时间进行更新.
trying to update datetime column in details view when the row is modified, any suggestions ?
A Details view with columns of data including datetime and user columns. Any time a modification is performed user id and the datetime coulmn needs to be updated with user id and the time of the update.
推荐答案
我在想你使用DataGridView或类似的来显示您的数据吗?如果是这样,我将确保您要修改的对象实现INotifyPropertyChanged接口.
E.G.
I''m thinking that you are using a DataGridView or similar to show your data? If so I would make sure that the object that you are modifying implements the INotifyPropertyChanged interface.
E.G.
class User : INotifyPropertyChanged
{
protected virtual void SendPropertyChanged(String propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private int id;
public int ID
{
get { return id; }
set
{
if(id != value)
{
id = value;
idmodified = DateTime.Now;
SendPropertyChanged("ID");
}
}
}
private DateTime idmodified;
public DateTime IDModified
{
get {return idmodified;}
set
{
if(idmodified != value)
{
idmodified = value;
SendPropertyChanged("IDModified");
}
}
}
}
然后,当更改DateTime并相应更新时,将通知您DataGridView控件.
Then you DataGridView control will be informed when the DateTime is changed and update accordingly.
这篇关于在详细信息视图中更新日期时间列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文