public void GridViewLookupEdit() { // Create an in-place LookupEdit control. //RepositoryItemLookUpEdit repositoryItemGridLookUpEdit1 = new RepositoryItemLookUpEdit(); DataTable dtShift = BUS_Ca.LoadCa(); repositoryItemLookUpEdit1.DataSource = dtShift; repositoryItemLookUpEdit1.ValueMember = "id"; repositoryItemLookUpEdit1.DisplayMember = "name"; // Enable the "best-fit" functionality mode in which columns have proportional widths and the popup window is resized to fit all the columns. repositoryItemGridLookUpEdit1.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; // Specify the dropdown height. repositoryItemLookUpEdit1.DropDownRows = BUS_Ca.LoadCa().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. gridViewPhanCa.Columns["shift_id"].ColumnEdit = repositoryItemLookUpEdit1; gridViewPhanCa.BestFitColumns(); }
private void frmPhanCa_Load(object sender, EventArgs e) { dtpNgayHieuLuc.Format = DateTimePickerFormat.Custom; dtpNgayHieuLuc.CustomFormat = "yyyy-MM-dd"; gridControl1.DataSource = lstNhanVien; //List<DTO_Ca> lstCa = new List<DTO_Ca>(); DataTable dtCa = BUS_Ca.LoadCa(); lkShift.Properties.DataSource = dtCa; lkShift.Properties.DisplayMember = "name"; lkShift.Properties.ValueMember = "id"; lkShift.Properties.NullText = "Chọn ca làm việc"; lkShift.EditValue = dtCa.Rows[0][0]; lkShift.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; // Specify the dropdown height. lkShift.Properties.DropDownRows = dtCa.Rows.Count; //lkInput.Properties.ReadOnly = true; }
private void frmKTPhanCa_Load(object sender, EventArgs e) { #region Xử lý lookupEdit dtboPhan = BUS_BoPhan.LoadBoPhan(ad_org_id); lkBoPhan.Properties.DataSource = dtboPhan; lkBoPhan.Properties.DisplayMember = "description"; lkBoPhan.Properties.ValueMember = "id"; lkBoPhan.Properties.NullText = "Chọn bộ phận"; lkBoPhan.EditValue = dtboPhan.Rows[0][0]; lkBoPhan.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; // Specify the dropdown height. lkBoPhan.Properties.DropDownRows = dtboPhan.Rows.Count; //lkInput.Properties.ReadOnly = true //List<DTO_Ca> lstCa = new List<DTO_Ca>(); DataTable dtCa = BUS_Ca.LoadCa(); lkShift.Properties.DataSource = dtCa; lkShift.Properties.DisplayMember = "name"; lkShift.Properties.ValueMember = "id"; lkShift.Properties.NullText = "Chọn ca làm việc"; //lkShift.EditValue = dtCa.Rows[0][0]; lkShift.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; // Specify the dropdown height. lkShift.Properties.DropDownRows = dtCa.Rows.Count; //lkInput.Properties.ReadOnly = true; #endregion radioGroup.SelectedIndex = 0; groupBox2.Enabled = false; groupBox3.Enabled = false; Reset.Enabled = false; dateEdit.EditValue = DateTime.Now.Date; dateEdit1.EditValue = DateTime.Now.Date; #region Redundance /* * //List<DTO_Ca> lstCa = new List<DTO_Ca>(); * DataTable dtCa = BUS_Ca.LoadCa(); * * * lkShift.Properties.DataSource = dtCa; * lkShift.Properties.DisplayMember = "name"; * lkShift.Properties.ValueMember = "id"; * lkShift.Properties.NullText = "Chọn ca làm việc"; * lkShift.EditValue = dtCa.Rows[0][0]; * * lkShift.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; * // Specify the dropdown height. * lkShift.Properties.DropDownRows = dtCa.Rows.Count; * //lkInput.Properties.ReadOnly = true; #endregion * radioGroup.SelectedIndex = 0; * * int i = Convert.ToInt16(user_level_id); * if (i > 1) * { * btnUpdate.Enabled = true; * } * else * { * btnUpdate.Enabled = false; * } */ #endregion }