Devexpress Gridview在asp.net mvc中隐藏Editform

时间:2013-10-05 13:48:42

标签: model-view-controller gridview devexpress hide

如果我的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";
});

任何帮助都将与积分相关。

1 个答案:

答案 0 :(得分: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
    }
};

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