示例#1
0
        public static List<string> GetListFromExcel(string term, int tableIndex)
        {
            string FilePath = HttpContext.Current.Server.MapPath("content\\PickList.xlsx");

            ExcelFile ef = new ExcelFile(FilePath);
            DataSet ds = ef.GetDropDownList();

            List<string> list = new List<string>();

            foreach (DataRow row in ds.Tables[tableIndex].Rows)      // 0 => Observation table
            {
                if (row[0].ToString().Contains(term))
                {
                    list.Add(row[0].ToString());
                }
            }

            return list;
        }
示例#2
0
        //----------------------------------------------------
        protected void PopulateDropdownFromExcel()
        {
            string FilePath = Server.MapPath("content\\PickList.xlsx");

            ExcelFile ef = new ExcelFile(FilePath);

            DataSet ds = ef.GetDropDownList();

            //--------------------------------------------------
            DropDownListDataBind("ddObservation", ds.Tables[0]);
            DropDownListDataBind("ddDeficiency", ds.Tables[1]);
        }