This is a migrated thread and some comments may be shown as answers.

[Solved] CurrentFilterValue format?!

4 Answers 173 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 03 Jun 2008, 10:02 PM
In my example that I am trying to complete I have two grids, and I drag items from grid "FROM" to grid "TO". (drag and drop)

Once I drag an item from grid "FROM" into "TO", I would like to "filter" out the item so it no longer shows in the grid "FROM".

I can't however just remove it from "FROM" data source, because the user can search again, and the items will show back in the DS.

Here is a example of the filter command that I currently call, after moving items
From the "FROM" grid to the "TO" grid
            // Create a list of items to filter by (for the the main search grid) 
            string strItemsToFilter = ""
            foreach (ITEM item in GridToDS) 
            { 
                strItemsToFilter += "([UniqueObjectID] <> '" + item.UniqueObjectID + "') AND "
            } 
 
            // Remove " AND " from the filtered items list 
            if (strItemsToFilter.Length > 0) 
                strItemsToFilter = strItemsToFilter.Substring(0, strItemsToFilter.Length - 5); 
 
            grdFROM.Columns.FindByUniqueName("UniqueObjectID").CurrentFilterValue = strItemsToFilter; 
 
            grdFROM.Rebind(); 


Any help would be greatly :-)

Thanks!

4 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 05 Jun 2008, 05:55 AM
Hello Matt,

In your RowDrop event handler, you can just hide your dragged items in the FROM table:

protected void RadGrid1_RowDrop(object sender, GridDragDropEventArgs e) 
   foreach (GridItem item in e.DraggedItems) 
   { 
      item.Visible = false
   } 

I hope this helps.

Kind regards,
Veli
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Matt
Top achievements
Rank 1
answered on 05 Jun 2008, 03:17 PM
This works great until the user wants to filter items on the FROM grid. As soon as I apply a filter to the FROM grid, the item become visible again. Also when the user wants update the FROM grid with more specific information (Rebind), the grid should still hide the items that can be found in the TO grid.

Thanks again for your input!
0
Matt
Top achievements
Rank 1
answered on 05 Jun 2008, 05:24 PM
Another thing that I saw was that the grid doesn't refresh the alt style on the grid.
(ex. If I have 3 records and alt style of (red, blue, red) and I hide the blue item, now I have two records in the FROM grid, both of which are red)

Thanks! :-)
0
Veli
Telerik team
answered on 06 Jun 2008, 09:56 AM
Hello Matt,

The suggested approach is a very basic form of row hiding and it cannot be applied successfully when other factors such as the ones you describe are at hand. If you need to successfully integrate all these functionalities, a suggested approach would be to keep your updated data in the view state of the page, delete the row that has been moved in the RowDrop event handler and rebind the grid to the data from the view state. Thus, you can ensure the actual data source is not affected, while still having RadGrid rebind successfully and apply its visual styles and behavior.

Best wishes,
Veli
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Veli
Telerik team
Matt
Top achievements
Rank 1
Share this question
or