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

Issue with filtering/hierachy in radgrid

2 Answers 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 16 Jul 2009, 12:28 PM
Is it possible filter only 1 item at a time in the grid? For instance...if a user clicks the filter button, the row expands to display my controls. Now if the user filters a different row, i would like it to close the previous filtered row, then display the currently selected row.
I used the following example...
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx


2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 16 Jul 2009, 01:15 PM
Hello Ben,

I'm not sure as to what you mean by filtering. From what I understand, I suppose you want to expand one row at a time in your hierarchial grid:
c#:
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
    {         
      if (e.CommandName == RadGrid.ExpandCollapseCommandName) 
        { 
          foreach (GridItem item in e.Item.OwnerTableView.Items) 
             { 
                if (item.Expanded && item != e.Item) 
                  { 
                     item.Expanded = false
                  } 
             } 
        }         
    } 

Thanks
Princy.
0
Ben
Top achievements
Rank 1
answered on 16 Jul 2009, 01:47 PM
That worked. Thanks!
Tags
Grid
Asked by
Ben
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ben
Top achievements
Rank 1
Share this question
or