Cant access all rows loaded in RadGrdiview when Visualization is enabled

2 posts, 0 answers
  1. sangram
    sangram avatar
    3 posts
    Member since:
    Mar 2016

    Posted 08 Mar 2016 Link to this post

    We have gone through feedback about UI virtualzation in Telerik grdiview but cant cant find solution for below approach

    We have gridview in which we are loading data but We are facing issues in enable/disable Cell or Focus cell at any row of GridView.

    Visualization is set to ON and we are using below code to get all rows of gridview

      var rows = RadGridView1.ChildrenOfType<GridViewRow>();

    this code is returning only those set of rows which are visible in viewport

    Those rows that are visible in the view port are initialized and can be access to cell which are visible in view port .however problem occurs with remaining rows which are not visible in View Port. when We tried to access rows with are not visible in view port but loaded in Radgrdiview , then it throws error "Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"

    Is there any way through which we can access all rows . so that i can enable or disable any cell of RadGrdiView?

    We don't want to disable Visualization, that will impact on performance of RadGridView.

  2. Stefan Nenchev
    Stefan Nenchev avatar
    603 posts

    Posted 09 Mar 2016 Link to this post

    Hi Sangram,

    As RadGridView is a virtualized component, working directly with its visual elements is highly not recommended. The UI Virtualization mechanism recycles the already created cell and row elements and reuses them for all the items within the underlying data source. 

    Instead, we advise on working with the items of the RadGridView directly. The approach which you can use in your case is a CellStyleSelector, if you need to style a cell based on some condition, or RowStyleSelector, if the element targetted is the whole row.  You can check demos that implement the CellStyleSelector and the RowStyleSelector in our SDK Samples Browser which you can download from the following link -

    Stefan Nenchev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top