protected void Page_Load(object sender, EventArgs e) { DataAccessServiceClient cl = new DataAccessServiceClient(); EmployeeDataContract edc = cl.GetEmployeeData(0); DropDownListSql.DataTextField = "Name"; DropDownListSql.DataValueField = "Id"; DropDownListSql.DataSource = edc.Employees.ToList(); DropDownListSql.DataBind(); }
private void InitialiseDropDownlist(List <dynamic> temp) { #region From XML CountriesDropDownlist.DataSource = (temp).ToList(); CountriesDropDownlist.DataTextField = "Text"; CountriesDropDownlist.DataValueField = "Value"; CountriesDropDownlist.DataBind(); #endregion #region From SQL DataAccessServiceClient cl = new DataAccessServiceClient(); EmployeeDataContract edc = cl.GetEmployeeData(0); DropDownListSql.DataTextField = "Name"; DropDownListSql.DataValueField = "Id"; DropDownListSql.DataSource = edc.Employees.ToList(); DropDownListSql.DataBind(); #endregion }