private void FillFactory() { const string METHOD_NAME = "FillFactory"; try { ArrayList listIDs = new System.Collections.ArrayList(_factoryList.Split(new char[] { ',' })); ListBox lst = lstFaFactory; lst.Items.Clear(); string cropYear = ((MasterReportTemplate)Master).CropYear; List<ListBeetFactoryIDItem> stateList = BeetDataDomain.BeetFactoryIDGetList(Convert.ToInt32(cropYear)); System.Text.StringBuilder sbList = new System.Text.StringBuilder(""); foreach (ListBeetFactoryIDItem state in stateList) { ListItem item = new ListItem(state.FactoryLongName, state.FactoryID); lst.Items.Add(item); if (listIDs.Contains(item.Value)) { lst.Items[lst.Items.Count - 1].Selected = true; // Rebuild factoryList because the listIDs are now qualified sbList.Append(item.Value + ","); } } if (sbList.Length > 0) { sbList.Length = sbList.Length - 1; } _factoryList = sbList.ToString(); } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }
private void FillFactory() { const string METHOD_NAME = "FillFactory"; try { ListBox lst = lstFactory; lst.Items.Clear(); List <ListBeetFactoryIDItem> ftyList = BeetDataDomain.BeetFactoryIDGetList(Convert.ToInt32(Common.UILib.GetDropDownText(ddlCropYear))); lst.DataTextField = "FactoryLongName"; lst.DataValueField = "FactoryID"; lst.DataSource = ftyList; lst.DataBind(); if (lst.Items.Count > 0) { lst.Items[0].Selected = true; } } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }