/// <summary> /// Sets the business object collection to populate the grid. If the grid /// needs to be cleared, set an empty collection rather than setting to null. /// Until you set a collection, the controls are disabled, since any given /// collection needs to be provided by a suitable context. /// </summary> public void SetBusinessObjectCollection(IBusinessObjectCollection col) { if (col == null) { throw new ArgumentNullException("col"); } ReadOnlyGridControl.SetBusinessObjectCollection(col); ReadOnlyGridControl.SelectedBusinessObject = col.Count > 0 ? col[0] : null; _newButton.Enabled = true; }
private void SetupReadOnlyGridControl(string gridUiDefName) { ReadOnlyGridControl = _controlFactory.CreateReadOnlyGridControl(); ReadOnlyGridControl.Height = 300; ReadOnlyGridControl.Buttons.Visible = false; ReadOnlyGridControl.FilterControl.Visible = false; IClassDef classDef = ClassDef.Get <TBusinessObject>(); if (!string.IsNullOrEmpty(gridUiDefName)) { ReadOnlyGridControl.Initialise(classDef, gridUiDefName); } AddGridSelectionEvent(); ReadOnlyGridControl.DoubleClickEditsBusinessObject = false; }