I have a custom web part which shows a different interface when in edit mode.
When in edit mode the default control panel displays on the right. When the user clicks OK, Cancel or Apply the web part stays in edit mode.
I want the custom web part to leave edit mode when the user selects OK or Cancel in the control panel.
Currently in the CreateChildControls method of the part I check the mode of the page by
bool editMode = false;
WebPartManager wpm = WebPartManager.GetCurrentWebPartManager(this.Page);
if (wpm.SelectedWebPart != null) {
string selectedId = wpm.SelectedWebPart.ID;
string thisId = this.ID;
if (thisId.Equals(selectedId)) {
editMode = true;
}
}
After the user clicks OK or Cancel the editMode remains true.
Ideas? (thx)