2

如果数量单元格中的值已更新,我正在尝试更改兄弟单元格(天)的值。问题是我不确定如何访问日间单元。这是我到目前为止所拥有的。

 private void UltraGridEdit_AfterCellUpdate(object sender, CellEventArgs e)
        {
            if(e.Cell.Column.PropertyDescriptor.DisplayName.Equals("Amount"))
            {
                UltraGridHsaContributionEdit.ActiveRow.Band.Columns["StartDate"].?

            }
        }
4

3 回答 3

5

你试过这个

e.Cell.Row.Cells["StartDate"].Value = DateTime.Today; //or whatever your date is
于 2011-08-19T21:08:28.820 回答
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
}

希望这可以帮助。

于 2011-08-19T21:07:59.990 回答
0

这是我得出的解决方案与您的解决方案非常相似。

private void UltraGridEditAfterCellUpdate(object sender, CellEventArgs e)
            {
                if (e.Cell.Column.PropertyDescriptor.DisplayName.Equals("Amount"))
                {
                    UltraGridEdit.ActiveRow.Cells["StartDate"].Value = null;
                }
            }
于 2011-08-19T21:17:55.557 回答