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
Violeta Popa
NA
137
163k
filter datagrid by many criteria
Apr 25 2013 5:32 AM
Hi :P
I have a datagridview and i want to filter it by many criteria. I have 3 checkboxes. This is my code:
int value=0;
if (checkBox1.Checked == true)
value = 1;
else if (checkBox2.Checked == true)
value = 2;
else if (checkBox3.Checked == true)
value = 3;
switch (value)
{
case 1:
{
dgv.DataSource = dataSet.Tables["client"].DefaultView;
dataSet.Tables["client"].DefaultView.RowFilter = "denumire LIKE '%" + textBox1.Text + "%'";
break;
}
case 2:
{
dgv.DataSource = dataSet.Tables["client"].DefaultView;
dataSet.Tables["client"].DefaultView.RowFilter = "cuicnp LIKE '%" + textBox2.Text + "%'";
break;
}
case 3:
{
if (comboBox1.SelectedItem.ToString() == "Personal")
{
dgv.DataSource = dataSet.Tables["client"].DefaultView;
dataSet.Tables["client"].DefaultView.RowFilter = "tip_client LIKE 'personal'";
}
}
}
Even though i check 2 checkboxes the dgv is filtered by the first criteria, and to be filtered by both Thanks!
Reply
Answers (
1
)
messagebox.show(textbox.text) displays null
C# Enum Keyword