Hi,
I'm not able to edit cell in the Ultragrid. I've set all the properties required for editing to true. I'm able to change the value in the cell, but as soon as I select a new cell, my update is not applied.
My grid is linked to bindingsource which is filled by a dataset.
Any idea ?
Thank you!
When you edit a cell in an Ultragrid that uses a ProBindingSource, the value needs to get propagated back to the data source (e.g., a temp-table field) in order for the value to "stick". There are 2 ways to do this.
1. Set the AutoUpdate property to true on the BindingSource. If this is true, the BindingSource will automatically try to update the field from the value entered into the grid. This defaults to false because most developers want more control of their updates - like what happens if an error occurs.
2. Subscribe to an UltraGrid event (sorry, I don't offhand know which one) that occurs when the cell is updated. More likely when you try to leave the cell or the row, there is an event that allows you do to validation or whatever. I don't know if it's a grid event or a Row object event, etc. Someone else can probably help you with this. Here is where you would get the cell value and update the temp-table field. When the event fires and your handler runs, the updated row will be in your TT buffer.
At least to start, you can set AutoUpdate to true to see that it works. Then you can enhance that by using the event model.
Well, to repeat myself, you need to propagate the modified value back to your data source, (e.g., the temp-table) in order for the new value to "stick".
You can set the AutoUpdate property of the binding source to true and it will automatically try to do the update. This property defaults to false because most developers want more control over their updates - i.e., to control what happens if an error occurs.
Or you can subscribe to an event - thank you Roger - like the BeforeRowUpdate event. Then in there you can set the TT field value from the grid's current cell value. The event handler parameter gives you access to the modified Row object and from there you can get the cell value. The TT buffer will already be populated with the record for that row. You just have to set the field.
When you edit a cell in an Ultragrid that uses a ProBindingSource, the value needs to get propagated back to the data source (e.g., a temp-table field) in order for the value to "stick". There are 2 ways to do this.
1. Set the AutoUpdate property to true on the BindingSource. If this is true, the BindingSource will automatically try to update the field from the value entered into the grid. This defaults to false because most developers want more control of their updates - like what happens if an error occurs.
2. Subscribe to an UltraGrid event (sorry, I don't offhand know which one) that occurs when the cell is updated. More likely when you try to leave the cell or the row, there is an event that allows you do to validation or whatever. I don't know if it's a grid event or a Row object event, etc. Someone else can probably help you with this. Here is where you would get the cell value and update the temp-table field. When the event fires and your handler runs, the updated row will be in your TT buffer.
At least to start, you can set AutoUpdate to true to see that it works. Then you can enhance that by using the event model.
Do people see my last update (about AutoUpdate, etc). Because I can no longer see it. I presume the post about BeforeRowUpdate was a response to what I said.
Laura, I can't see your response about autoupdate
I do not see your post. My BeforeRowUpdate was in response to your post.
Well, to repeat myself, you need to propagate the modified value back to your data source, (e.g., the temp-table) in order for the new value to "stick".
You can set the AutoUpdate property of the binding source to true and it will automatically try to do the update. This property defaults to false because most developers want more control over their updates - i.e., to control what happens if an error occurs.
Or you can subscribe to an event - thank you Roger - like the BeforeRowUpdate event. Then in there you can set the TT field value from the grid's current cell value. The event handler parameter gives you access to the modified Row object and from there you can get the cell value. The TT buffer will already be populated with the record for that row. You just have to set the field.
Thank you, setting AutoUpdate property to TRUE solve my problem.