鸳孑刀

导航

验证GridControl Gridview 单元格。

一般的验证方法,使用单元格值改变事件。现在记录另一个事件实现验证。

场景:控制当某个单元格的值的长度不能超过10

直接看代码:

  private void gridViewFileContent_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
        {         
                      
            if (e.Value.ToString().Length > 10)
            {
                e.ErrorText = "值太长,请精简,或分行填入";
                e.Valid = false;
            }

        }

  

 效果就是这样子:

 

posted on 2017-12-21 10:26  街西  阅读(459)  评论(0编辑  收藏  举报