Hello
I have four Dropdownlist and i want to show data in gridview.
when i select from ddlCategory[Dropdownlist] is not Null and other dropdown are null then i want to show only one category that time else return all the category.
But its showing all the category in if condition..plz help
con.Open();
if (ddlCategory.SelectedValue != "" && ddlSubCategory.SelectedItem.Text == "" && ddlBrand.SelectedItem.Text == "" && ddlItem.SelectedItem.Text == "")
{
SqlCommand cmd = new SqlCommand("select Distinct Category from tblMatCat where Category = @Category ", con);
cmd.Parameters.AddWithValue("@Category", ddlCategory.SelectedItem.Text);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
}
else
{
SqlCommand cmd = new SqlCommand("select Distinct Category from tblMatCat ", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
}


Jignesh KumarRank #91 · 22.9K reputationPosted Aug 23, 2018, 11:54 PM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Aug 24, 2018, 6:27 AM EDT
Vincent Maverick DuranoRank #238 · 10.3K reputationPosted Aug 24, 2018, 6:33 AM EDT
Code AloneRank #488 · 5.1K reputationPosted Aug 24, 2018, 9:01 AM EDT
ankit gaurRank #3,567 · 408 reputationPosted Aug 24, 2018, 9:57 PM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Aug 25, 2018, 12:02 AM EDT
Ruchi SharavatRank #1,714 · 885 reputationPosted Aug 31, 2018, 1:16 AM EDT