private void Addgrid_Detail(int?[] Equip_ID) { List <Equipment> lstEquipments = null; Equipment[] Equipments = null; ClassSet.LoadTypeEquipment(out Equipments, null, Equip_ID); if (Equipments != null && Equipments.Any()) { lstEquipments = SSEquipments; if (lstEquipments == null || !lstEquipments.Any() || lstEquipments.Count < 1) { lstEquipments = new List <Equipment>(); } lstEquipments.AddRange(Equipments); lstEquipments = lstEquipments.OrderBy(x => x.Name).ToList(); } SSEquipments = lstEquipments; grid_Detail.DataSource = lstEquipments; grid_Detail.DataBind(); }
protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e) { Equipment[] Equipments = null; int _type = Convert.ToInt32(ddlCategory.SelectedItem.Value); ClassSet.LoadTypeEquipment(out Equipments, _type, null); if (Equipments != null && Equipments.Any()) { this.ddlEquipmentList.Items.Clear(); this.ddlEquipmentList.Items.Add(new ListItem("กรุณาเลือก", "-1")); foreach (Equipment en in Equipments) { this.ddlEquipmentList.Items.Add(new ListItem(en.Fullname, en.ID.ToString())); } this.ddlEquipmentList.SelectedIndex = 0; } }