下面的示例代码接管了 ColumnView.CellValueChanged 事件,在 FirstName 列的取值被修改之后更新 FullName 列的取值。
C# | 复制代码 |
---|
using DevExpress.XtraGrid.Views.Base;
private void bandedGridView1_CellValueChanged(object sender, CellValueChangedEventArgs e) {
if (e.Column.Caption != "FirstName") return;
string cellValue = e.Value.ToString() + " " +
bandedGridView1.GetRowCellValue(e.RowHandle,
bandedGridView1.Columns["LastName"]).ToString();
bandedGridView1.SetRowCellValue(e.RowHandle,
bandedGridView1.Columns["FullName"], cellValue);
}
|
Visual Basic | 复制代码 |
---|
Imports DevExpress.XtraGrid.Views.Base
Private Sub BandedGridView1_CellValueChanged(ByVal sender As Object, _
ByVal e As CellValueChangedEventArgs) Handles BandedGridView1.CellValueChanged
If e.Column.Caption <> "FirstName" Then Exit Sub
Dim cellValue As String = e.Value.ToString() + " " + _
BandedGridView1.GetRowCellValue(e.RowHandle, _
BandedGridView1.Columns("LastName")).ToString()
BandedGridView1.SetRowCellValue(e.RowHandle, _
BandedGridView1.Columns("FullName"), cellValue)
End Sub
|