Example #1
0
        public void GridViewLookupEdit()
        {
            #region Ghi chú
            // Create an in-place LookupEdit control.
            //RepositoryItemLookUpEdit repositoryItemGridLookUpEdit1 = new RepositoryItemLookUpEdit();
            DataTable dtAbsent = BUS_ChamCong.LoadAbsent();
            repositoryItemLookUpEdit1.DataSource    = dtAbsent;
            repositoryItemLookUpEdit1.ValueMember   = "id";
            repositoryItemLookUpEdit1.DisplayMember = "description";
            repositoryItemLookUpEdit1.NullText      = "Chọn lý do vắng";


            // Enable the "best-fit" functionality mode in which columns have proportional widths and the popup window is resized to fit all the columns.
            repositoryItemLookUpEdit1.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
            // Specify the dropdown height.
            repositoryItemLookUpEdit1.DropDownRows = dtAbsent.Rows.Count;

            // Enable the automatic completion feature. In this mode, when the dropdown is closed,
            // the text in the edit box is automatically completed if it matches a DisplayMember field value of one of dropdown rows.
            repositoryItemLookUpEdit1.SearchMode = DevExpress.XtraEditors.Controls.SearchMode.AutoComplete;
            // Specify the column against which an incremental search is performed in SearchMode.AutoComplete and SearchMode.OnlyInPopup modes
            repositoryItemLookUpEdit1.AutoSearchColumnIndex = 1;

            // Optionally hide the Description column in the dropdown.
            repositoryItemLookUpEdit1.PopulateColumns();
            repositoryItemLookUpEdit1.Columns["id"].Visible = false;

            // Assign the in-place LookupEdit control to the grid's CategoryID column.
            // Note that the data types of the "ID" and "CategoryID" fields match.
            repositoryItemDateEdit1.NullText = string.Empty;
            repositoryItemDateEdit2.NullText = string.Empty;

            gridView1.Columns["att_reason"].ColumnEdit = repositoryItemLookUpEdit1;
            //gridView1.Columns["created"].ColumnEdit = repositoryItemDateEdit1;
            //gridView1.Columns["updated"].ColumnEdit = repositoryItemDateEdit2;
            gridView1.BestFitColumns();
            #endregion
        }