Hi
How to remove selected row from UltraGrid ??
Hi princekp,
If you are trying to remove the last row - the one on the bottom of the grid, try this:
// C#yourUltraGrid.Rows[yourUltraGrid.Rows.Count - 1].Delete(); ' VByourUltraGrid.Rows(yourUltraGrid.Rows.Count - 1).Delete()
If you are trying to delete the last few rows from the bottom of the list, try this:
// C#int RowsToDelete = 4;for (int i = 0; i < RowsToDelete; i++){ yourUltraGrid.Rows[yourUltraGrid.Rows.Count - 1].Delete();} ' VBDim RowsToDelete As Integer = 4For i As Integer = 0 To RowsToDelete: yourUltraGrid.Rows(yourUltraGrid.Rows.Count - 1).Delete()Next i
If you are trying to delete all rows, try this:
// C#yourUltraGrid.DeleteSelectedRows();' VByourUltraGrid.DeleteSelectedRows()
Here is something I used for deleting rows NOT selected:
int _iRowIx = 0; while (grdSearchResults.Selected.Rows.Count < grdSearchResults.Rows.Count) { if (!grdSearchResults.Rows[_iRowIx].Selected) { grdSearchResults.Rows[_iRowIx].Delete(); _iRowIx = 0; } else _iRowIx += 1; } _dtOrderLines.AcceptChanges(); grdSearchResults.UpdateData();
Sorry no. I cant see any other without trigger an event.
Thanks for your reply. PerformAction does remove all the selected rows from UltraGrid but it triggers another event Afterselectchange which shud be avoided. Is there any way to do it
try this:
grid.PerformAction(
UltraGridAction.DeleteRows);
i think this way will work. there are a lot of actions that you can use there for further development.