C1 Community
ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

Setting the content of a single data grid cell

rated by 0 users
This post has 5 Replies | 1 Follower

Not Ranked
Posts 2
Andrew8 Posted: Tue, Jun 23 2009 1:57 PM

How do you set the content of single cell.  For example I would like to set the grid cell at row 2, column 3  = 67   c1grid(2,3) = 67.  Then how do you read that value back programatically.  I don't want to bind to anything and I am only interested in the values of a single cell.

Brian

Top 25 Contributor
Posts 346

Hi Brian,

In order to change the value of a cell you must change the corresponding data item, you don't need to change anything in the datagrid. But the data item must implement INotifyPropertyChanged to be auto-refreshed.

Why do you want to set a cell value? do you mind giving us more info about you want to achieve?

Regards,

Alvaro.

Not Ranked
Posts 2
Andrew8 replied on Tue, Jun 23 2009 6:26 PM

Alvaro,

Thanks for your fast reply.  I was hoping to be able to treat the grid similar to a flexGrid (winForms) where I can write and retrieve cell by cell.  I can do the same thing with my asp.net grid component by one of your competitors.  Many times it is nice to be able to do a series of calculations and write the results directly to the grid with out the over-head of creating a class with get and set properties and then use the class as a data source. 

If I understand what you are saying the only way to change the cell data is to change the underlying class data that is used for the data source and the datagrid will be updated. 

What are you defining as a data item?

 Thanks

Brian

 

 

 

 

 

 

 

 

 

 

Top 25 Contributor
Posts 346

Hi Brian,

Andrew8:

If I understand what you are saying the only way to change the cell data is to change the underlying class data that is used for the data source and the datagrid will be updated. 

You're right.

Andrew8:

What are you defining as a data item?

The data object could be any object, this object should have properties to bind these properties against the columns.

Regards,

Alvaro.

 

Top 10 Contributor
Posts 1,264
C1_LeoV replied on Wed, Jun 24 2009 10:06 AM
Hi Brian,

Just to add some information....

The object bound to the C1DataGrid can also be a C1.Silverlight.Data.DataView, and so you can set the cell values as easy as you expected through the DataGrid itself, like:

myDataView[1][3] = "23";

Regards

Follow me: Twitter.com/leovernazza/

Top 100 Contributor
Posts 48
bdwest replied on Wed, Jun 24 2009 6:21 PM

Thanks for the clarification.

 Brian

Page 1 of 1 (6 items) | RSS
Contact ComponentOne: 1.800.858.2739 ©1987-2010 ComponentOne LLC All Rights Reserved.