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

Cant access all rows loaded in RadGrdiview when Visualization is enabled

1 Answer 116 Views
Data Virtualization
This is a migrated thread and some comments may be shown as answers.
sangram
Top achievements
Rank 1
sangram asked on 08 Mar 2016, 11:46 AM

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.

1 Answer, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 09 Mar 2016, 08:28 AM
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 - http://demos.telerik.com/xaml-sdkbrowser/.

Regards,
Stefan Nenchev
Telerik
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
Tags
Data Virtualization
Asked by
sangram
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Share this question
or