Hello, I have a grid and a checked listbox, what I want to do is filter de grid by selecting/deselecting the listbox items, i had it working, but I don't know why it stopped working, this is the code:
This code was exceuted on the ItemCheck property of the listbox, but then I made some changes to other parts of the code and it stopped working, why is this?
Regards.
| private void fncGridData(){ |
| try |
| { |
| DataView dvDataView=new DataView(); |
| dvDataView = ((DataTable)Cache["Materials"]).DefaultView; |
| if (lstSubcategories.CheckedItems.Count == lstSubcategories.Items.Count) |
| { |
| dvDataView.RowFilter = ""; |
| } |
| else if(lstSubcategories.CheckedItems.Count==0){ |
| dvDataView.RowFilter = "id_sub_category=-1"; |
| } |
| else { |
| dvDataView.RowFilter = "id_sub_category IN (" + fncQueryComplement() + ")"; |
| } |
| RadGrid1.DataSource = (DataTable)Cache["Materials"]; |
| } |
| finally |
| { |
| SqlConnection.Close(); |
| } |
| } |
This code was exceuted on the ItemCheck property of the listbox, but then I made some changes to other parts of the code and it stopped working, why is this?
Regards.