protected void MRPmonthyear_Init(object sender, EventArgs e) { ASPxComboBox combo = sender as ASPxComboBox; combo.DataSource = CapexCIP.MRPMonthYearTable(); ListBoxColumn l_value = new ListBoxColumn(); l_value.FieldName = "PK"; l_value.Width = 0; combo.Columns.Add(l_value); ListBoxColumn l_text = new ListBoxColumn(); l_text.FieldName = "MRPMonth"; combo.Columns.Add(l_text); ListBoxColumn l_text2 = new ListBoxColumn(); l_text2.FieldName = "MRPYear"; combo.Columns.Add(l_text2); combo.ValueField = "PK"; combo.TextField = "MRPMonth"; combo.DataBind(); combo.TextFormatString = "{1} {2}"; }
private void BindCapex(string month, string year, string entity, string bu) { if (string.IsNullOrEmpty(month) && string.IsNullOrEmpty(year)) { return; } CAPEXCIP.DataSource = CapexCIP.CAPEXCIP_Table(month, year, entity, bu); CAPEXCIP.KeyFieldName = "PK"; CAPEXCIP.DataBind(); }
protected void BUCallback_Callback(object sender, CallbackEventArgsBase e) { //MRPClass.PrintString("callback"); string var = MRPmonthyear.Text.ToString(); pk = MRPmonthyear.Value.ToString(); int spaceindex = var.IndexOf(" "); int secondlength = var.Length - (spaceindex + 1); string monthvar = var.Substring(0, spaceindex); int monthIndex = Convert.ToDateTime("01-" + monthvar + "-2011").Month; month = monthIndex.ToString(); year = var.Substring(spaceindex + 1, secondlength); ASPxComboBox combo = BUCombo as ASPxComboBox; combo.Text = ""; combo.Columns.Clear(); combo.Items.Clear(); combo.DataSource = CapexCIP.BusinessUnit(EntityCombo.Value.ToString(), monthIndex, year); ListBoxColumn lv = new ListBoxColumn(); lv.FieldName = "ID"; lv.Caption = "Code"; lv.Width = 50; combo.Columns.Add(lv); ListBoxColumn lt = new ListBoxColumn(); lt.FieldName = "NAME"; lt.Caption = "Name"; combo.Columns.Add(lt); combo.ValueField = "ID"; combo.TextField = "NAME"; combo.DataBind(); combo.TextFormatString = "{1}"; combo.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True; }