Himadri
Himadri

Reputation: 8876

How to refresh parent page from child page in asp.net 2.0

I have a page showing all products in a gridview. I have a link in the page clicking on it opens a modal window. In the modal window there is a form to enter product and save. When I fill the form and save product I need to make the parent page to be refreshed so that the new product is listed in the gridview and a message will be shown in a label in the modal window. I need to refresh the product list page without closing the modal window. How to do it?

Please help.

Upvotes: 2

Views: 4623

Answers (2)

Amarghosh
Amarghosh

Reputation: 59451

window.opener.location.reload(true);

true makes sure that the page is reloaded from the server instead of the browser's cache.

This will work only if the second page was opened by the first page using javascript and not when you open a link in the first page in a new window - window.opener will be null in the later case. Even in the former case, Firefox will throw a 'permission denied' error if both pages are not from the same domain.

Upvotes: 1

Alex Gyoshev
Alex Gyoshev

Reputation: 11977

You can refresh it with the following JavaScript:

window.opener.location.reload(true);

Upvotes: 3

Related Questions