Hi,
If somebody could help me determine how to find the current column position of an active cell in contrast to the DataTable or visible/displayed grid.
I found how to get the current row of the activated cell, which is "ultragrid.ActiveCell.Row.VisibleIndex". So I was assuming that I could find the columns in "ultragrid.ActiveCell.Columns" but unfortunately I could not find a particular property that will return it.
Thanks,
Aaron
I was facing the same problem, I would like to set the active cell in a wingrid that consists of two bands.
I found this thread and here is what I did.
Dim row as UltragrirdRow = wingrid.ActiveRow
Dim cell as UltragridCell = wingrid.ActiveCell
The above is use to keep which row and which cell that was activated.
-------------------------------------------
Then I have the below codes to set the active mouse cursor.
wingrid.ActiveRow= row
wingrid. ActiveCell=cell
wingrid.PerformAction(UltragridAction.EnterEditMode)
Thanks mike, that was the easiest way to do about it. Works great now.
This code doesn't make a lot of sense. If you want to get the columns in the band, you should use something like this:
grid.DisplayLayout.Bands[band key].Columns[column key].Header.VisiblePosition = x
Using the row to get a cell to get back to the column is a really roundabout way to do it.
Also, when you set the VisiblePosition on the columns, you need to do it in order, because otherwise, it will be unpredictable. What I mean is.. you should assign the column you want in position 0 first, then position 1, then position 2. If you do it out of order and assign a column to position 5, for example, and then another column to position 4, the second column may change the position of the first one.
Is there a way to manually set it? I tried doing:
for each row in the ultragrid get a count
ultragrid.rows[count].cells[col].column.header.visibleposition = something
It doesn't seem to set the activecell.column.header.visibleposition to the way I want it to be, any suggestions?
I'm not sure. But the VisiblePosition property need not necessarily be contiguous. For example, it would be perfectly valid to have three columns with VisiblePositions of 1, 50, and 100.
The grid doesn't do that by itself, of course, and if you move a column in the grid, they will probably get re-numbered to 0, 1, and 2.
But it's impossible for me to guess why that's happening with the information at hand.