In my application i have multi selected dropdownlist and based on selection i need to display in gridview. If i select two items from multi select dropdown based on selected items i need to display records on gridview . In the below code i select two i am getting first selection records only.
i tried code:
protected void ddlcol2_SelectedIndexChanged(object sender, EventArgs e)
{
string qry = "select * from Collections where col1='" + ddlcol1.SelectedValue.ToString() + "' and col2='" + ddlcol2.SelectedValue.ToString() + "'";
SqlCommand cmd = new SqlCommand(qry,con);
DataTable dt = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
sda.Fill(dt);
Gridview1.DataSource = dt;
Gridview1.DataBind();
}
ddlcol2 is the multi select dropdown if i select two items from ddlcol2 i want to display that two items records on gridview.
Can anyone please tell me to how to do this.
Thank you