Click to See Complete Forum and Search --> : multiple rowfilter help please


learningcsharp
October 12th, 2005, 06:22 PM
i have the rowfilters running functioning individually but now i want to make one button that will pick up all 3 values and rowfilter that way, here is what i have, im pretty sure im goign to need some if/then's to get these 3 criteria to work togather, any help is appreciated!

private void btnSchoolFilter_Click(object sender, System.EventArgs e)
{
objdsStudents.Tables["students"].DefaultView.RowFilter = "schoolID =" + this.comboBox5.SelectedValue.ToString();
this.dataGrid1.Refresh();
}

private void button3_Click(object sender, System.EventArgs e)
{
objdsStudents.Tables["students"].DefaultView.RowFilter = "diabetes = 0";
this.dataGrid1.Refresh();
}

private void button4_Click(object sender, System.EventArgs e)
{
objdsStudents.Tables["students"].DefaultView.RowFilter = "zip =" + this.zipfilter.Text.ToString();
this.dataGrid1.Refresh();
}

maqsoodahmed
October 13th, 2005, 01:09 AM
You can use AND and OR to concat the RowFilters.
something like this...
objdsStudents.Tables["students"].DefaultView.RowFilter = "(schoolID = " + this.comboBox5.SelectedValue + ") AND diabetes = 0 AND zip = " + this.zipfilter.Text;

HTH.