دوست عزیز منم تو برنامه ای که دارم مینویسم به این مشکل بر خوردم مشکل خودم رو اینجوری حل کردم کدش رو برات میذارم خیلی ساده و قابل فهمه
string Search="";
if(chk_Oid.Checked)
if (Search=="")
Search = Search+" oid='" + txt_Oid.Text + "'";
else
Search = Search + "and oid='" + txt_Oid.Text + "'";
if(chk_SaleLandedType.Checked)
if (Search=="")
Search = Search + " type1='" + cmbType1.SelectedIndex + "'and type2='" + cmbType2.SelectedIndex + "'";
else
Search = Search + "and type1='" + cmbType1.SelectedIndex + "'and type2='" + cmbType2.SelectedIndex + "'";
if(chk_Price.Checked)
if (Search == "")
Search=Search+" price='"+txt_Price.Text+"'";
else
Search = Search + "and price='" + txt_Price.Text + "'";
if(chk_Area.Checked)
if (Search == "")
Search = Search + " area='" + txt_Area.Text + "'";
else
Search = Search + "and area='" + txt_Area.Text + "'";
if(chk_Room.Checked)
if (Search == "")
Search = Search + " room='" + txt_Room.Text + "'";
else
Search = Search + "and room='" + txt_Room.Text + "'";
objDataView.RowFilter = Search;
توجه داشته باش که من چندتا چک باکس گذاشتم که توسط اونها تکست باکسهان فعال یا غیر فعال میشن، این کد را باید تو دگمه جستجو قرار بدی البته این در صورتی است که جستجو رو توسط dataview و rowfilter انجام بدی