How would I get the actively or just clicked menu item on the server.
From the MenuItemClicked event, it is easy to check the WebMenuItemEventArgs.Item property. However, I need to get it from a different event.
In my case, its when a UltraWebGrid RowBatch event has fired. In certain cases we want the rowbatch event to abort. For instance, if the user clicks File->Cancel in the UltraWebMenu, the RowBatch events will fire and we want to check to see which Item was selected so we can abort the process.
How can I get the currently selected item in the UltraWebMenu.
I tried setting it from the clientside events and storing it in a hidden field. But the hidden field isn't getting the value I assign it before the grids RowBatch events are fired.
If I could just access the selected item in the UltraWebMenu???
I don't know if this would work, but I would try handling the MenuItemClicked event, and saving the menu item's key in ViewState, for future reference.
Initially, I thought you meant MenuItemClicked client-side event. Meaning, in clientside event, put it in viewstate. After researching this I see its not possible. Then I read over your post again and you mean MenuItemClicked Server-Side event. At this point, it is to late as the grids batch update methods have already been fired.
We even tried putting it in a hidden field (setting hidden field in client-side menu event) but the hidden field hasn't yet been populated when the Batch Update/Delete are fired. One would think all control viewstate would of been binded back to the control?
I thought about trying to set a grid property with the selected menu item but can't find a property I can set using CSOM. Their is a grid.bands.tag that would be perfect but I can't figure out how to set it in CSOM.
So it comes down to, if there was just a way on the server to get the currently selected menu item. Isn't there any property in the Menu that specifies which Item is active or selected?
I guess you are handling one of the server side events to update your data: UpdateCellBatch, AddRowBatch, DeleteRowBatch or pdateRowBatch.
Inside those events you get the grid rows that were changed, added or removed and then you update your datasource accordingly. Do not commit the changes yet!
When the ItemClicked event fires, if the item was "cancel", just discard the changes and reload your datasource. Maybe you'll have to rebind the grid to discard the changed/added grid rows.
If the Item that was clicked is "Ok" go ahead and commit your changes, then rebind so the grid gets the new changes.
I recommend the samples "Grid/Editing Data/Row Updating" and "Grid/Editing Data/Database Updating" from the samples page:
http://samples.infragistics.com/2008.2/webfeaturebrowser/default.htm