We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Reading cell value

I am using GDBG in a hierarchical view. In prepareviewstyleinfo event, how do I get the cellvalue of [e.rowindex,27], if current row is a child row. Thanks,

6 Replies

AD Administrator Syncfusion Team November 22, 2005 07:52 AM UTC

Is this possible without using DataRowView?


AD Administrator Syncfusion Team November 22, 2005 09:38 AM UTC

To get the cellvalue, you can use object val = this.gridDataBoundGrid1[e.RowIndex,27].CellValue; To decide what level a particular row is, you use the GridBoundRecordState object. GridBoundRecordState state = grid.Binder.GetRecordStateAtRowIndex(e.RowIndex); //state.Level holds the hierarchy level for the row.


AD Administrator Syncfusion Team November 22, 2005 05:01 PM UTC

Since i am using the grid in hierarchical view, when i use the following syntax this.gridDataBoundGrid1[e.RowIndex,27].CellValue it always return empty string, probably because the parent datatable has only 12 columns and child datatable has 28 columns. I use this syntax at child row always. D you see any issue or am I doing something wrong. Please find the attached file that contain the code that doesn''t work.

code.zip


AD Administrator Syncfusion Team November 22, 2005 05:34 PM UTC

f you know the index of the DataRow in your child table, then you will have to get the data from the child table. When I suggested using grid[27, colindex].CellValue, I was assuming that you knew 27 as a RowIndex in the grid. If 27 is a index into anything other than the grid, then you will not be able to index the grid with it and retrieve the value. What I was suggesting would work if you are in a GridCellClick event and you want to know the value that was click. Then you could use grid[e.RowIndex, e.ColIndex].CellValue and it would return the value no matter whether you clicked a parent row or a child row. This is because e.RowIndex and e.ColIndex are indexes into the grid. What is not working in your code? When you step through it, what gives you the wrong values? Have you confirmed that the values of the column indexes are what they should be. (The plus/minus occupies a column -- are you takingthat into account?).


AD Administrator Syncfusion Team November 22, 2005 07:51 PM UTC

Please see the code in attached file. This is the code from PrepareViewStyleInfo even,, so I always have e.RowIndex and I know that I need read cell value of Column # 28. This # 28 is the number of gridboundcolumn which correct for sure but if we see corresponding mapping column in child datatable is 26. So basically I need read the cell value for current row (e.rowindex) for the grid column # 28 (which internally column # 26 in child datatable.) I guess i am doing something wrong. please help. VS

code1.zip


AD Administrator Syncfusion Team November 22, 2005 08:15 PM UTC

Without a working sample that I can debug, I do not know how to help you.

Loader.
Live Chat Icon For mobile
Up arrow icon