Here is one class i've provided, you just pass dropdown id, table name and table id
public void PopulateDropDown(DropDownList ddlList, string tblName, string colName, string colValue, string srchCodn, Page form)
{
try
{
string sqlQuery = "Select 'Select' as " + colName + ",0 as " + colValue + " Union Select " + colName + "," + colValue + " from " + tblName;
if (srchCodn != "")
{
sqlQuery += " " + srchCodn;
}
adp = new SqlDataAdapter(sqlQuery, conn);
tbl = new DataTable();
adp.Fill(tbl);
ddlList.DataSource = tbl;
ddlList.DataTextField = colName;
ddlList.DataValueField = colValue;
ddlList.DataBind();
}
catch (Exception ex)
{
MsgBox("Populate DropDown Error: " + ex.Message, form);
}
}
Hope this helps you to bind dropdown. Happy coding.