hi,
iam working in Web application in ASP.if i select one item in Dropdown list, then immediatly that item information is displayed in gridview?how?plz help me
How to display the information in gridview when item selected in dropdown list?ASP
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Amit ChoudharyRank #145 · 15.8K reputationPosted Nov 10, 2009, 12:09 AM EST
First set the AutopostBack="True" for you Dropdownlist...
then on its Selected_index_Changed event write this code:
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { string sql = "Select * from Categories where CategoryName=" + DropDownList1.SelectedItem.Text; SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStrings["LisamCn"].ToString(); ; conn.Open(); SqlDataAdapter da = new SqlDataAdapter(sql, conn); DataTable dt = new DataTable(); conn.Close(); da.Fill(dt); GridView1.DataSource = dt; GridView1.DataBind(); }And Done.... Enjoy Coding..
=========================
If you like this answer please chekc the "mark it as a s answer"..