protected void WorkUnit_DataBinding(object sender, EventArgs e) { ASPxComboBox workUnit = sender as ASPxComboBox; DataTable dt = new DataTable(); dt.Columns.Add("DISPLAY"); dt.Columns.Add("VALUE"); userManager theUserManager = (userManager)Session["theUserManager"]; List <LocationEntity> locations = LocationFactory.GetAll(); List <ProductLineEntity> PLines = ProductLineFactory.GetAll(); foreach (ProductLineEntity p in PLines) { dt.Rows.Add(p.PLINE_NAME, p.RMES_ID); } foreach (LocationEntity l in locations) { dt.Rows.Add(l.LOCATION_NAME, l.RMES_ID); } workUnit.DataSource = dt; workUnit.ValueField = "VALUE"; workUnit.TextField = "DISPLAY"; //workUnit.DataBind(); }
private void setCondition() { List <ProcessEntity> allEntity = ProcessFactory.GetAll(); ASPxGridView1.DataSource = allEntity; DataTable dt = new DataTable(); dt.Columns.Add("DISPLAY"); dt.Columns.Add("VALUE"); List <LocationEntity> locations = LocationFactory.GetAll(); List <ProductLineEntity> PLines = ProductLineFactory.GetAll(); foreach (ProductLineEntity p in PLines) { dt.Rows.Add(p.PLINE_NAME, p.RMES_ID); } foreach (LocationEntity l in locations) { dt.Rows.Add(l.LOCATION_NAME, l.RMES_ID); } GridViewDataComboBoxColumn col = ASPxGridView1.Columns["WORKUNIT_CODE"] as GridViewDataComboBoxColumn; col.PropertiesComboBox.DataSource = dt; col.PropertiesComboBox.ValueField = "VALUE"; col.PropertiesComboBox.TextField = "DISPLAY"; DataTable dt1 = new DataTable(); dt1.Columns.Add("DISPLAY"); dt1.Columns.Add("WORKSHOP_CODE"); dt1.Rows.Add("园区", "8101"); dt1.Rows.Add("基地", "8102"); GridViewDataComboBoxColumn com = ASPxGridView1.Columns["WORKSHOP_CODE"] as GridViewDataComboBoxColumn; com.PropertiesComboBox.DataSource = dt1; com.PropertiesComboBox.ValueField = "WORKSHOP_CODE"; com.PropertiesComboBox.TextField = "DISPLAY"; ASPxGridView1.DataBind(); }