void Bind() { DataAccess.Core.DAEmployee empService = new DataAccess.Core.DAEmployee(); var data = empService.List(); grdEmployees.DataSource = data; grdEmployees.DataBind(); }
void BindEmployee() { DataAccess.Core.DAEmployee service = new DataAccess.Core.DAEmployee(); var data = service.List().Select(x => new {Name = string.Format("{0}, {1}",x.LastName,x.FirstName), id = x.Id }).ToList(); ddlEmployee.DataSource = data; ddlEmployee.DataTextField = "Name"; ddlEmployee.DataValueField = "Id"; ddlEmployee.DataBind(); }