Hi all,
i am using ultra grid. i need to check whether active cell is last column of ultragrid or not. please help out for this
Hello Gurumurthy,
In order to access the active cell of the grid, you can use the ActiveCell property, which will return or set the active cell of the grid. After that, its column index should be checked if it is equal to the index of the last column, the code should look similar to this:
var cell = this.ultraGrid1.ActiveCell;
if (cell != null && cell.Column.Index == this.ultraGrid1.DisplayLayout.Bands[0].Columns.Count - 1)
{
//your custom logic
}
Please let me know if you have any questions.
Regards, Ivan Kitanov
thanks for the reply ivan
Actually in grid datasource contains 59 columns. but I am showing only 5 column for index mismatch happening
I’m glad that you found my suggestion helpful and managed to resolve your issue.
Thank you for using Infragistics!
hey thanks ivan its working
As far as I understood you would like to create a new row inside the grid when the user tabs out from the last cell of the last row using the KeyDown event of the grid. This could be achieved with the suggestions I provided mentioned in my previous response.
I am attaching a small sample that demonstrates this. While running it, when the user presses tab the active cell is being checked if it belongs to the last row of the grid and also if the cell is from the column, which has the last VisiblePosition index. If the cell meets this conditions a new row is added to the grid.
Please test the sample on your side and let me know if you have any questions.
TabOutRowAddNewRow.zip
Debug.WriteLine((this.ultraGrid1.CurrentState & UltraGridState.CellLast) == UltraGridState.CellLast, "CellLast");Debug.WriteLine((this.ultraGrid1.CurrentState & UltraGridState.RowLast) == UltraGridState.RowLast, "RowLast");
i tried above code but shows syntax error in c#. please suggest
I have a grid with only one band, yet many hidden columns. I am capturing the tab key in the key up event and want to automatically add a new row to the band, providing the active cell belongs to the last visible column in the band.
How do i determine if the active cell, belongs to the last visible column in the current band?