private void GridBind() { try { DAL = new DataAccessLayer(); DataTable dtbl = DAL.GetAllPolls(); gvPolls.DataSource = dtbl; gvPolls.DataBind(); DropDownList ddl = gvPolls.FooterRow.FindControl("ddlPollRoleFooter") as DropDownList; List <ListItem> Role_Names = new List <ListItem>(); Dictionary <string, string> list = DAL.GetRoleName(); foreach (KeyValuePair <string, string> entry in list) { Role_Names.Add(new ListItem(entry.Key, entry.Value.ToString())); } ddl.Items.AddRange(Role_Names.ToArray()); } catch (Exception ex) { lblErrorMessage.Visible = true; lblErrorMessage.Text = "DataBinding Exception: " + ex.Message; lblErrorMessage.ForeColor = System.Drawing.Color.Red; } }