I''m evaluating Essential Suite for purchase and have run into an issue.
I don''t EVER want to show the default row and column headers. I know I can hide them, but then the row/column indexing gets screwed up.
For example, if I have default row and column headers, one additional row and column header, and 3 rows and 3 columns of data (a 5x5 grid), the cells are indexed 0-4,0-4 as expected.
If I create that same grid, then hide row 0 and column 0 to eliminate the default headers, the cells are indexed 0,2,3,4 x 0,2,3,4. This does not seem correct to me. Where is row/column 1? I would expect 1-5, 1-5 or 0-3,0-3 as indexes, but why the skip?
Is there a better way to eliminate the default headers and maintain proper zero-based indexing, or do I have to work out some special workaround?
>If I create that same grid, then hide row 0 and column 0 to eliminate the default headers, the cells are indexed 0,2,3,4 x 0,2,3,4. This does not seem correct to me. Where is row/column 1? I would expect 1-5, 1-5 or 0-3,0-3 as indexes, but why the skip?
Oops, that should be 1-4, 1-4 or 0-3,0-3
ADAdministrator Syncfusion Team November 3, 2004 11:20 AM
In a GridControl, by default, row 1 is always the first scrollable row an dis immediately under row 0 which is the column header row. Similaril, column 0 is the row header column, and column 1 is the column next to it. This normally makes cell 1,1 (whose value can be seen as grid[1,1].Text) the first scrollable cell in either direction.
Now if you hide the headers,say using grid.Model.Rows.Hidden = true, and similarily for the Cols, the above indexing is exactly the same. Cell 1,1 is still the first scrollable cell. (It is just the headers are hidden, but they still use index 0).
Now form your question, I think you are not seeing this when you should. If you can upload a little sample showing the problem, we can probably explain what you are seeing.
Now if you are using a hierarchical GridDataBoundGrid, then there are special column considerations in regard to multiple header rows and th eplus/minus column. If this is what you are seeing, then you can always use grid.Model.Cols.HeaderCount and grid.Model.Rows.HeaderCOunt to see where the real grid starts.
KSKeith SteinbeckNovember 3, 2004 04:22 PM
This is what was happening. I was creating the grid as I described, and hiding the default row/column headers using Hidden = true. The reason I was getting the weird index values was that I was using ViewLayout.PointToClientRowCol and in the call there is a bool called "fixBackHidden". Initially it was set to true which gave me the skipped indexes (0,2,3,4). If it is set to false, the indexes run 1-4 and match those generated by the CellClick event for the cell in question.
I can live with non-zero indexing now that this has been worked out.
Thanks for the help.