Friday, February 20, 2009

For data driven web application most of the times we did this job. There are lot of way to handle this issue. Here i am trying to show you few process that how we can handle it. To describe this problem here i am using datatable instead of database since anyone can replace my code easily by his own data reader block. Let we have a requirement that a page contains list of suppliers. Below the supplier list client wants to add a link to add more suppliers like:

If user click on add more supplier link then the link open a popup to enter supplier details. After entering the supplier details when user click on the save button then system automatically save the data & close the popup as well as reflect the currently added row to the opener like:

So now we can start step by step. At first add a page named parentrefresh.aspx. Then add a gridview to display the existing suppliers. After the gridview we need to add a link button/html button to popup the window. So parentrefresh.aspx looks like:

Now we need to add another page named childrefresh.aspx which will be our popup window. If you look at the first page link button click event then you found this page url as a popup. Find the child page html contents from below:

The onunload event basically refresh the parent page. Here you can refresh parent page by location or reload by using onunload="window.opener.location.reload();"Or you can call a javascript function within onunload handler. Initially start with below code. After than practice above ways.

Using this way you can change the query parameter of parent window/provide a completely a new url. Interesting.........

One another thing sometime you would like To know the parent address due to security issue or To handle multiple opener for a popup, that time you can use window.opener.location.href To validate the parent window.

your article is so nice, here am getting problem..using the window.open('some.aspx');return false; here a new window is opening but it's not look like a pop-up it looking like a page.... but i want to resizes that one please any one help me....