This topic is locked
[SOLVED]

 Detecting Edit Mode in Popup

6/10/2019 4:32:13 PM
ASPRunner.NET General questions
J
jetsguy author

Reference to this: Open Javascript Popup Window then automatically close it after saving
Placing the following code in after record added" will close a popup and reload the calling page.
//Save popup and refresh window!

var message2 = "<script type=\'text/javascript\'> window.parent.location.reload(false); self.close(); </script>";

MVCFunctions.EchoToOutput(message2);
The problem with this is that it reloads the calling page even if that page is in EDIT mode. The edit mode is cancelled and the page reloads without saving any data.

Any tips or tricks to possibly detect edit mode in the calling page. Or maybe even programmatically press save on the calling page from the popup?
Looking if any of you have come across this and what best practice you have used.
Thanks,

Eric

admin 6/11/2019

I don't think I follow. Are you trying to open a popup from the page that is already in the popup? Can you provide the whole picture?

J
jetsguy author 6/11/2019



I don't think I follow. Are you trying to open a popup from the page that is already in the popup? Can you provide the whole picture?


I have a normal List page with a button on it. The button opens the add page of another table in a pop up. After I close the pop up I would like to refresh the list page BUT the problem is if the list page is in edit mode

when I press the button and open the popup then you lose some data when you reload.
Maybe a better way to show my issue is the following steps.

  1. List page.
  2. Put List page in Edit mode.
  3. Edit some data without pressing save.
  4. Click a button which opens the add page of another table in a pop up.
  5. I would like to save the list page if it is in edit more before I reload it after the pop up is closed.

admin 6/11/2019

What does it mean "List page in Edit mode"?

J
jetsguy author 6/13/2019



What does it mean "List page in Edit mode"?


Inline edit.

admin 6/13/2019

I see what you saying. Technically speaking you can do something like this but it looks like a bad design.
You can use jQuery to find and click all Save buttons/icons on that page before reloading the page. The problem is that you need to wait till all records get actually saved before refreshing the page. If you refresh it too soon some changes won't be saved. This is why I call it a bad design.

J
jetsguy author 6/13/2019



I see what you saying. Technically speaking you can do something like this but it looks like a bad design.
You can use jQuery to find and click all Save buttons/icons on that page before reloading the page. The problem is that you need to wait till all records get actually saved before refreshing the page. If you refresh it too soon some changes won't be saved. This is why I call it a bad design.


Okay thank you. I'll steer away from that.