dev gridview表格按钮,按行设置名称

设置表格CustomDrawCell事件,在表格事件里处理

 private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            if (e.Column.Name == "gcoperation")//操作
            {
                var row = gridView1.GetRow(e.RowHandle) as SystemConfigModel;
                if (row != null)
                {
                    var but = (DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit)e.Column.ColumnEdit;
                    if (row.disabled.ToString() == "禁用")
                    {
                        but.Buttons[1].Caption = "启用";
                    }
                    else
                    {
                        but.Buttons[1].Caption = "禁用";
                    }
                }
            }
        }

 

posted @ 2021-11-08 11:25  世人皆萌  阅读(203)  评论(0编辑  收藏  举报