I programmatically changed the value of a cell but it does not appear to be persisting. I tried UpdateData() prior to saving the bound sourcelist, but the row is not flagged as changed. How can I force this?
Also, in addition I would like to programmatically select each row in a foreach loop and not sure how to do this:
For example:
foreach (UltraGridRow row in grdStatus){ // doing long-running stuff per row and would like to show a highlighted row selection on the grid}
Finally, I would like to add an unbound progress bar in a cell that will show percent completed in the above iteration. Is this doable?
ericgeas said:I programmatically changed the value of a cell but it does not appear to be persisting. I tried UpdateData() prior to saving the bound sourcelist, but the row is not flagged as changed. How can I force this?
If UpdateData is not working, it's possible that you need to take the cell out of edit mode first by calling PerformAction(ExitEditMode).
ericgeas said:Also, in addition I would like to programmatically select each row in a foreach loop and not sure how to do this
HOWTO:What is the best way to programmatically select all rows in the grid?
1) Another option is to set your grid's updatemode property to OnCellChargeOrLostFocus. This will force updates as soon as the cell has been changed. The default mode is to wait until the user exists the row.
2) You can select one or more rows by setting the row object's selected property to true in your loop. The only thing I see in your code is that your loop needs to be for each row in grdStatus.Rows.
3) You can create an unbound column and add a progress bar control as the editor. All you should have to do when processing that row is grab a reference to the row's editor control.
If it's the same issue I've run into the problem is you're not taking the cell out of edit mode. If I need the cell updated value before the cell has lost focus I generally use
gridname
.PerformAction(DeactivateCell) or you could use exitEditMode.