Exemplo n.º 1
0
        protected void bindEmployeeList()//binding the employee dropdown
        {
            DataTableConversion lsttodt = new DataTableConversion();

            IEmployeeInterface service = new EmployeeRepository();
            var       lst = service.GetEmployeeDataFunc().Select(x => new { x.Name, x.ID }).ToList();
            DataTable dt  = lsttodt.ToDataTable(lst);

            if (dt != null && dt.Rows.Count > 0)
            {
                EmployeeID.DataSource     = dt;
                EmployeeID.DataTextField  = "Name";
                EmployeeID.DataValueField = "ID";
                EmployeeID.DataBind();
            }
            else
            {
                EmployeeID.DataBind();
            }
        }