Access only filtered rows in grid

10 posts, 0 answers
  1. Cory
    Cory avatar
    11 posts
    Member since:
    Feb 2011

    Posted 31 Oct 2011 Link to this post

    How do I access only the filtered rows in a grid.  I basically need to select the first row that is visible after setting a filter.  I also have other needs for accessing only the rows that are still visible after a filter, but this is my first need.
  2. Stefan
    Admin
    Stefan avatar
    2911 posts

    Posted 02 Nov 2011 Link to this post

    Hi Cory,

    Thank you for writing.

    The filtered, sorted or grouped rows can be found in the ChildRows collection of the desired template. So in order to select the first row after the filtering operation, please consider the following code:
    radGridView1.ChildRows[0].IsSelected = true;

    I hope that you find this information helpful. Should you have any other questions, do not hesitate to contact us.
     
    Kind regards,
    Stefan
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

  3. Cory
    Cory avatar
    11 posts
    Member since:
    Feb 2011

    Posted 02 Nov 2011 Link to this post

    Thank you!  That's perfect.
  4. Stefan
    Admin
    Stefan avatar
    2911 posts

    Posted 07 Nov 2011 Link to this post

    Hi Cory,

    I am glad that I could help. If there is anything else we can assist you with, do not hesitate to contact us.
     
    All the best,
    Stefan
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

  5. Christopher
    Christopher avatar
    1 posts
    Member since:
    Sep 2012

    Posted 21 Sep 2012 Link to this post

    Hi Stefan,

    Could I get an answer for Cory's second question? I am trying to get the rows that are visible in the gridview after filtering has been applied.

    interating with row.isvisible and row.selected dont seem to work.

    Thanks,
    Chris
  6. Stefan
    Admin
    Stefan avatar
    2911 posts

    Posted 25 Sep 2012 Link to this post

    Hi Christopher,

    The filtered, sorted or grouped rows can be found in the ChildRows collection of the desired template. The currently visible rows can be found in radGridView1.TableElement.VisualRows. Please note that the latter collection contains of GridRowElement objects and you need to access their RowInfo property to access the actual data row.
     
    Greetings,
    Stefan
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  7. Jerry
    Jerry avatar
    10 posts
    Member since:
    Mar 2013

    Posted 28 Dec 2017 Link to this post

    Using Silverlight and MVVM, we have a RadGridView where users can filter rows. That works great, only the rows that meet the filter display in the RadGridView.

    But we also have a checkbox on top of the RadGridView to "Select All" rows. When checked, a method in our ViewModel is called to perform a ForEach() over the Observable that is bound to the ItemsSource of the RadGridView. However, we can't tell which row is filtered by the UI control, so all rows get checked, which is wrong.

    How can we read the RadGridView ChildRows property from a ViewModel?

     

  8. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3954 posts

    Posted 29 Dec 2017 Link to this post

    Hello, Jerry, 

    Thank you for writing.  

    I would like to note that this forum is related to the Telerik UI for WinForms suite. However, your question seems to be related to Silverlight. Feel free to post your inquiries in the relevant forum: https://www.telerik.com/forums

    I hope this information helps. 
     
    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  9. Michael
    Michael avatar
    47 posts
    Member since:
    Oct 2010

    Posted 12 Dec 2018 Link to this post

    Hi,

     

    I have  radgrid view with thousands of records.  Grid has paging enabled with 50 records per page.  I am using built-in filter option to filter some data. The result can be more than 50 records, hence more than 1 page.  I need to perform some action on the backend on all filtered records.

     

    How do I get a list of all filtered records? I tried your suggestion ChildRows, but it returns up to 50 rows.  Looks like it is just list of records currently visible on a page.  I need to get all filtered records, no matter how many pages there are.  Is it possible and how?  If this is not possible, is it possible hook up to events of filter changes and get all parameters of filters so I can apply filter to the binded dataset myself?

     

  10. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3954 posts

    Posted 13 Dec 2018 Link to this post

    Hello, Michael,     

    When paging is enabled, the ChildRows collection contains the data rows displayed on the specific page. In order to get all filtered data, you can first disable the paging, iterate the ChildRows collection and enable again the paging. 

    Alternatively, the MasterTemplate.DataView.Indexer.Items contains all the rows in the order in which they appear in the grid. 

    foreach (GridViewRowInfo row in ((GridDataView)grdDummy.MasterTemplate.DataView).Indexer.Items)
    {
        Console.WriteLine(row.Cells[1].Value);
    }

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top