开发者

Changing cell in GridView by vlidation

开发者 https://www.devze.com 2023-02-25 01:38 出处:网络
I have a GridView and I want when I change a cell to see if开发者_如何学JAVA its new value is valid by mine function ValidateValue(string aValue) and if it is valid - to store the new value and old va

I have a GridView and I want when I change a cell to see if开发者_如何学JAVA its new value is valid by mine function ValidateValue(string aValue) and if it is valid - to store the new value and old value as a pair in Struct S {string old,new}; How to do this?


Handle the GridView's ValidatingCell event for this purpose. Here is some sample code showing how to obtain new and old edit values:

private void gridView1_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e) {
    BaseEdit edit = (sender as GridView).ActiveEditor;
    object oldValue = edit.OldEditValue;
    object newValue = e.Value;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消