1

如果我的 CustomerName FieldName 等于 "MyCustomer" ,我想隐藏对该行的编辑。

如果customername == "MyCustomer隐藏编辑

如何根据“MyCustomer”隐藏列编辑?

settings.Columns.Add(s =>
{
s.FieldName = "CustomerName";
s.Caption = "Customer";
s.Name = "CustomerColumn";
s.ColumnType = MVCxGridViewColumnType.ComboBox;
var comboBoxProperties = s.PropertiesEdit as ComboBoxProperties;
comboBoxProperties.DataSource =Model.CustomerList;
comboBoxProperties.TextField = "Customer_Name";
comboBoxProperties.ValueField = "Customer_Id";
comboBoxProperties.ValueType = typeof(int);
comboBoxProperties.ClientInstanceName = "CustomerColumn";
});

任何帮助都将获得积分。

4

1 回答 1

1
settings.CommandButtonInitialize = (s, e) => {
    if (e.ButtonType == ColumnCommandButtonType.Edit) {
        MVCxGridView g = s as MVCxGridView;
        var value = (int)g.GetRowValues(e.VisibleIndex, "RowFieldName"); //use a correct field name and cast a resultant value to a correct value type
        e.Visible = value > 10; // for example, only
    }
};

幸运的是,我有自己。我找到了解决方案。它有效。希望这对将来遇到同样问题的人有所帮助。

于 2013-10-05T15:37:34.663 回答