Go with this code:
protected void BindGridview()
{
con.Open();
string sponcor = "SELECT sponcorid FROM Registration_Master";
SqlCommand com = new SqlCommand(sponcor, con);
com.CommandType = CommandType.Text;
SqlDataAdapter da = new SqlDataAdapter(com);
DataTable dtsponcor = new DataTable();
da.Fill(dtsponcor);
DropDownList ddl = new DropDownList();
ddl = dtsponcor.Rows[0]["sponcorid"];
con.Close();
ddl.DataSource = dtsponcor;
ddl.DataTextField = "sponcorid";
ddl.DataValueField = "sponcorid";
ddl.DataBind();
ddl.Items.Insert(0, new ListItem("--Select--", "0"));
}
You're getting that error, because you were
String to
DropdownList... And that is not possible.. Okay, so here I have solved your problem :)