如何在UltraGrid中更改单元格内容
本文关键字:单元格 UltraGrid | 更新日期: 2023-09-27 18:06:14
我试图改变兄弟单元格(天)的值,如果金额单元格中的值被更新。问题是我不知道怎么进入日间牢房。以下是我到目前为止写的。
private void UltraGridEdit_AfterCellUpdate(object sender, CellEventArgs e)
{
if(e.Cell.Column.PropertyDescriptor.DisplayName.Equals("Amount"))
{
UltraGridHsaContributionEdit.ActiveRow.Band.Columns["StartDate"].?
}
}
你试过了吗
e.Cell.Row.Cells["StartDate"].Value = DateTime.Today; //or whatever your date is
您可以通过UltraGridCell的Row属性访问兄弟单元格:
private void UltraGridEdit_AfterCellUpdate(object sender, CellEventArgs e)
{
if(e.Cell.Column.Key == "Amount_Column_Key")
{
e.Cell.Row.Cells["StartDate"].Value = CalculateStartDateValue();
}
}
private DateTime CalculateStartDateValue()
{
// calculate start date value here
}
希望有帮助。
这是我想到的解决方案,与你们的非常相似。
private void UltraGridEditAfterCellUpdate(object sender, CellEventArgs e)
{
if (e.Cell.Column.PropertyDescriptor.DisplayName.Equals("Amount"))
{
UltraGridEdit.ActiveRow.Cells["StartDate"].Value = null;
}
}