protected void EmployeeGrid_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e) { Employee employee = objectSpace.GetObjectByKey <Employee>(e.KeyValue); string memberName = GetMemberName(e.Column); if (!security.CanRead(employee, memberName)) { e.Editor.Value = "*******"; e.Editor.Enabled = false; } else if (!security.CanWrite(employee, memberName)) { e.Editor.Enabled = false; } }
private void AddControl(LayoutControlItem layout, object targetObject, string memberName, string caption) { layout.Text = caption; Type type = targetObject.GetType(); BaseEdit control; if (security.CanRead(targetObject, memberName)) { control = GetControl(type, memberName); if (control != null) { control.DataBindings.Add(new Binding(nameof(BaseEdit.EditValue), targetObject, memberName, true, DataSourceUpdateMode.OnPropertyChanged)); control.Enabled = security.CanWrite(targetObject, memberName); } } else { control = new ProtectedContentEdit(); } dataLayoutControl1.Controls.Add(control); layout.Control = control; }