populating dropdownlist using storedprocedure and c# code
am trying to populate a dropdown list with faculties in the school and the subsequent faculty chosen should also populate another dropdown list below with departments in the faculty......i need help on this ASAP. thanks a lot
Jignesh TrivediPosted Mar 20, 2014, 5:08 AM
hi,
You mean to cascading dropdown with asp.net?
Please refer
http://www.asp.net/ajaxlibrary/ajaxcontroltoolkitsamplesite/cascadingdropdown/cascadingdropdown.aspx
http://support.microsoft.com/kb/976156
http://www.aspsnippets.com/Articles/Creating-Cascading-DropDownLists-in-ASP.Net.aspx
hope this will help you
Princy GuptaPosted Mar 20, 2014, 2:46 AM
private void FillDropDownList()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString);
SqlCommand cmd = new SqlCommand("Select * from students", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
DropDownList1.DataTextField = ds.Tables[0].Columns["FullName"].ToString();
DropDownList1.DataValueField = ds.Tables[0].Columns["id"].ToString();
DropDownList1.DataSource = ds.Tables[0];
DropDownList1.DataBind();
}
please accept the request if it has helped you