TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ankit gaur
1.4k
298
32.3k
Multiple conditions in If Else in C#
Aug 24 2018 2:25 AM
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);
}
Reply
Answers (
7
)
Why does my label under the textbox is visible?
DevExpress ASPxGridView client side row delete