I have a test SP page hosting a Sandbox WebPart, code only. The WebPart in turn contains a GridView.
I'd like to refresh the WebPart (actually, to fire the GridView-ObjectContainerDataSource selection process) after the user has done with modifying the WebPart, i.e after s/he has clicked OK in the (standard, non custom) right editor pane.
I've looked and tried with:
- overriding WebPart.OnEditModeChanged, but that was invoked only upon entering edit mode, not upon leaving it
- registering to WebPartManager.DisplayModeChanged during my web part's OnInit method, but that was never invoked in my tests.
I've searched on the web, but apparently everyone explains how to set the displaymode, and no one how to detect its changes :).
Any help? TA
I played a little bit with WebPart.OnEditModeChanged and ViewState. The problem is still due to OnEditModeChanged being called only on the first transition Display->Edit, then never again. This makes it impossible (I think) to track state when user does Display-Edit-Apply-Ok for example.