Krishna Rana

Krishna Rana

  • 1.5k
  • 336
  • 3.5k

parent.window.location.reload() firing last server event

Feb 22 2019 12:45 AM
I have a page where list of items is showing in gridview, another page to add/update items, this add/update page is opening in iframe as modal popup from parent page (client side). On this page i can add multiple items (server side code), and to see added items i m reloading the parent page using a javascript function.
  1. "text/javascript">  
  2. function reloadParent() {  
  3. parent.window.location.reload();  
  4. }  
  5. script>  
After saving data i m attaching this javascript function as below.
  1. ScriptManager.RegisterStartupScript(Page, typeof(Page), "test""reloadParent();"true);  
All is working fine as expected, but the problem is that before opening the modal popup, i delete an item from gridview (server side by gridview rowcommand event), and then i
open modal popup to add more item. After adding the item when parent page is reloading
then delete code (written in gridview rowcommand event ) is firing again, and a record is
being deleted, i.e. if I add 5 record then 5 record is added in database, but when parent
page is reloading then, last server event ( delete ) is firing again.
how to restrict last server event to fire when parent page is reloading from child page.