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

Computing in CellFormatting changes Summarize columns on scroll

1 Answer 41 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Cloud
Top achievements
Rank 1
Cloud asked on 12 Jun 2017, 11:30 AM

Hello, Telerik!

For some reason I cannot find my previous thread.

Here is your answer for my previous question:

*****************

Hello Alexander, 

Thank you for writing.  

Due to the UI virtualization in RadGridView, cell elements are created only for currently visible cells and are being reused during operations like scrolling, filtering, grouping and so on. The CellFormatting event is fired only for the visible cells in the grid. That is why you obtain this unexpected behavior. Note that the CellFormatting event is purposed to customize the cells' style and it is not recommended to change the cell's value in this event. Changing the value of a cell will trigger an update of the current view and thus the CellFormatting event will be fired again. This may lead to any other unexpected behavior. I would recommend you to update the cells' values outside the CellFormatting event handler, e.g. in a RadButton.Click event. Thus, you can iterate the desired rows and for each row, you can change the value for the specific cell.

If it doesn't suit your scenario, it would be greatly appreciated if you can provide additional information about the exact goal that you are trying to achieve. Thus, we would be able to think about a suitable solution and assist you further. Thank you.

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess 
Progress Telerik

*************************

My further questions:

What other events during gridview load you can advise to compute values? RowFormatting will not work too?

If you recommend to compute after gridview load, can you tell me even and should I use Rows collection for iteration?

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 12 Jun 2017, 01:25 PM
Hi Cloud,

Your other thread has been converted to a support ticket and you can find it in your Telerik account: https://www.telerik.com/account/.

As to your question, please avoid setting the cell values in the formatting events. These events are related to the UI Virtualization of the control and are suitable for updates of the visual elements, e.g. back color, visibility etc. Once you bind the grid you can iterate the rows collection. For the purpose, you can consider handling the DataBindingComplete event and follow the approach here: http://docs.telerik.com/devtools/winforms/gridview/rows/iterating-rows.

I hope this helps. Should you further questions please do not hesitate to write back.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Cloud
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or