Beispiel #1
0
        public void DepartmentBind()
        {
            DataSet ds = assignGateway.GetDepartment();

            List <SelectListItem> departmentList = new List <SelectListItem>();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                departmentList.Add(new SelectListItem {
                    Text = dr["Name"].ToString(), Value = dr["Id"].ToString()
                });
            }

            ViewBag.DepartmentId = departmentList;
        }