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

[Solved] Access cells of column of grid view

1 Answer 73 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Manas Rastogi
Top achievements
Rank 1
Manas Rastogi asked on 07 Sep 2009, 06:32 PM
hi
I have a grid view with two columns as Column1 and Column2.On clicking a button, i need to increment the values of all cells which are under this particular column1.please help out.
thanks
manas

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 08 Sep 2009, 07:04 AM
Hi Manas Rastogi,

Well, updating the values in this manner could introduce some serious problems. If you are dealing with many rows some of them might not be available bacause of the virualization techniques that RadGridView uses - as a result some rows will not be updated.

A better approach is to update the actual data that the grid is bound to. If your grid is boud to customer objects and the column that you would like to update displays the age of all customers just update the property Age of all your objects (your data items should implement INotifyCollectionChanged interface).

public void UpdateAge()   
{  
   foreach(Customer customer in this.myGrid.Items)   
   {  
       customer.Age++;  
   }  

I have also attached a sample project that demonstrates the approach.

Kind regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Manas Rastogi
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or