如果更新金额单元格中的值,我正在尝试更改兄弟单元格(日期)的值。问题是我不知道如何访问日间单元格。这是我到目前为止所拥有的。
private void UltraGridEdit_AfterCellUpdate(object sender, CellEventArgs e)
{
if(e.Cell.Column.PropertyDescriptor.DisplayName.Equals("Amount"))
{
UltraGridHsaContributionEdit.ActiveRow.Band.Columns["StartDate"].?
}
}
答案 0 :(得分:4)
你试过这个吗?
e.Cell.Row.Cells["StartDate"].Value = DateTime.Today; //or whatever your date is
答案 1 :(得分:2)
您可以通过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
}
希望,这有帮助。
答案 2 :(得分:0)
这是我和你们两个人非常相似的解决方案。
private void UltraGridEditAfterCellUpdate(object sender, CellEventArgs e)
{
if (e.Cell.Column.PropertyDescriptor.DisplayName.Equals("Amount"))
{
UltraGridEdit.ActiveRow.Cells["StartDate"].Value = null;
}
}