private void GridBind() { try { DAL = new DataAccessLayer(); DataTable dtbl = DAL.GetAllRoles(); grdViewRoles.DataSource = dtbl; grdViewRoles.DataBind(); DropDownList ddl = grdViewRoles.FooterRow.FindControl("ddlInsertCandidateName") as DropDownList; List <ListItem> Candidate_Name = new List <ListItem>(); Dictionary <string, string> list = DAL.GetCandidatename(); foreach (KeyValuePair <string, string> entry in list) { Candidate_Name.Add(new ListItem(entry.Key, entry.Value.ToString())); } ddl.Items.AddRange(Candidate_Name.ToArray()); } catch (Exception ex) { lblException.Visible = true; lblException.Text = "Grid Bind Exception: " + ex.Message; lblException.ForeColor = System.Drawing.Color.Red; } }