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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Reading cell value

Thread ID:





37435 Nov 22,2005 07:36 AM UTC Nov 22,2005 08:15 PM UTC WinForms 6
Tags: GridControl
Administrator [Syncfusion]
Asked On November 22, 2005 07:36 AM UTC

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,

Administrator [Syncfusion]
Replied On November 22, 2005 07:52 AM UTC

Is this possible without using DataRowView?

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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.


Administrator [Syncfusion]
Replied On 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?).

Administrator [Syncfusion]
Replied On 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


Administrator [Syncfusion]
Replied On November 22, 2005 08:15 PM UTC

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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon