public void InitializeControls( ) { if (RelationConfig == null) { return; } if (RelationConfig.IsFromSource) { #region MainObject MainGridCtrl = new ABCGridControl(); MainGridCtrl.Initialize(RelationConfig.SourceTableName); bindingMain = new BindingSource(); MainGridCtrl.GridDataSource = bindingMain; MainGridCtrl.RefreshDataSource(); ABCGridColumn col = new ABCGridColumn(); col.FieldName = ABCCommon.ABCConstString.colSelected; col.Caption = "Chọn"; col.TableName = RelationConfig.SourceTableName; col.VisibleIndex = 0; col.Visible = true; col.Width = 20; col.OptionsColumn.AllowEdit = true; col.FilterMode = DevExpress.XtraGrid.ColumnFilterMode.DisplayText; col.OptionsFilter.AllowAutoFilter = true; col.ColumnEdit = new DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit(); MainGridCtrl.GridDefaultView.Columns.Insert(0, col); MainGridCtrl.Dock = System.Windows.Forms.DockStyle.Fill; MainGridCtrl.Parent = mainTab; MainGridCtrl.ShowSaveButton = false; MainGridCtrl.ShowDeleteButton = false; MainGridCtrl.ShowRefreshButton = false; MainGridCtrl.EnableFocusedCell = false; MainGridCtrl.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus; MainGridCtrl.BringToFront(); mainTab.Text = " Chọn " + DataConfigProvider.GetTableCaption(RelationConfig.SourceTableName); #endregion } if (RelationConfig.IsFromSourceItem) { #region ItemObject ItemGridCtrl = new ABCGridControl(); ItemGridCtrl.Initialize(RelationConfig.SourceItemTableName); bindingItem = new BindingSource(); ItemGridCtrl.GridDataSource = bindingItem; ItemGridCtrl.RefreshDataSource(); ABCGridColumn col = new ABCGridColumn(); col.FieldName = ABCCommon.ABCConstString.colSelected; col.Caption = "Chọn"; col.TableName = RelationConfig.SourceItemTableName; col.VisibleIndex = 0; col.Visible = true; col.Width = 20; col.OptionsColumn.AllowEdit = true; col.FilterMode = DevExpress.XtraGrid.ColumnFilterMode.DisplayText; col.OptionsFilter.AllowAutoFilter = true; col.ColumnEdit = new DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit(); ItemGridCtrl.GridDefaultView.Columns.Insert(0, col); ItemGridCtrl.Dock = System.Windows.Forms.DockStyle.Fill; ItemGridCtrl.Parent = itemTab; ItemGridCtrl.ShowSaveButton = false; ItemGridCtrl.ShowDeleteButton = false; ItemGridCtrl.ShowRefreshButton = false; ItemGridCtrl.EnableFocusedCell = false; ItemGridCtrl.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus; ItemGridCtrl.BringToFront(); itemTab.Text = " Chọn " + DataConfigProvider.GetTableCaption(RelationConfig.SourceItemTableName); #endregion } this.Shown += new EventHandler(ABCRelationChooser_Shown); this.ShowInTaskbar = false; this.StartPosition = FormStartPosition.CenterParent; this.Text = String.Format("Tạo {0} từ {1}", DataConfigProvider.GetTableCaption(RelationConfig.DestinyTableName), DataConfigProvider.GetTableCaption(RelationConfig.SourceTableName)); }