PostBack

  • Thread starter Thread starter Abid Ali
  • Start date Start date
A

Abid Ali

Dear All

I want to call dopostback of parent window from child window.

Scenerio
I am opening window from a page, and i have datatable in session which is
updating at parent window and at child window both.
when I close the child window and reloads the parent window from javascript
it lost all information because it walks into
"Not Ispostback" condition para.

How i can reload the parent page which did not walk into this condition
para.

Regards
Abid
 
Normally, you would expect to do this with

window.opener.document.forms[0].submit();

but this would not work because the IE implementation of form.submit() is
different from the standard implementation.

Nevertheless, there's a clever way to simulate a postback on the parent
window in javascript.

Put an invisible button to the parent page. Something like below;

<input type="submit" name="fakeButton" style="DISPLAY: none" value="Submit">

Then from the child window, do the following;

window.opener.document.forms[0].fakeButton.click();

This will submit the form back to itself, hence you have a postback.

Hope this helps,

Ethem Azun
 
window.opener.document.forms[0].submit();
but this would not work because the IE implementation of form.submit() is
different from the standard implementation.

This is news to me. Can you elaborate?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

Ethem Azun said:
Normally, you would expect to do this with

window.opener.document.forms[0].submit();

but this would not work because the IE implementation of form.submit() is
different from the standard implementation.

Nevertheless, there's a clever way to simulate a postback on the parent
window in javascript.

Put an invisible button to the parent page. Something like below;

<input type="submit" name="fakeButton" style="DISPLAY: none" value="Submit">

Then from the child window, do the following;

window.opener.document.forms[0].fakeButton.click();

This will submit the form back to itself, hence you have a postback.

Hope this helps,

Ethem Azun


Abid Ali said:
Dear All

I want to call dopostback of parent window from child window.

Scenerio
I am opening window from a page, and i have datatable in session which is
updating at parent window and at child window both.
when I close the child window and reloads the parent window from javascript
it lost all information because it walks into
"Not Ispostback" condition para.

How i can reload the parent page which did not walk into this condition
para.

Regards
Abid
 
Hi Kevin,

From below, you can see the The HTML DOM Level 2 standard. It says that
calling form.submit() should do the same as button.submit().

http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-76767676

This means, when you submit a form, the onsubmit event should normally fire.
But this does not happen if you use IE.

I use the workaround I specified before to get over this problem, simply
"clicking" on an invisible submit button on the form, from outside. You can
test this behavoir by creating two pages in which one pops the other up and
the popup tries to submit the opener form.

Ethem Azun

Kevin Spencer said:
window.opener.document.forms[0].submit();

but this would not work because the IE implementation of form.submit() is
different from the standard implementation.

This is news to me. Can you elaborate?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

Ethem Azun said:
Normally, you would expect to do this with

window.opener.document.forms[0].submit();

but this would not work because the IE implementation of form.submit() is
different from the standard implementation.

Nevertheless, there's a clever way to simulate a postback on the parent
window in javascript.

Put an invisible button to the parent page. Something like below;

<input type="submit" name="fakeButton" style="DISPLAY: none" value="Submit">

Then from the child window, do the following;

window.opener.document.forms[0].fakeButton.click();

This will submit the form back to itself, hence you have a postback.

Hope this helps,

Ethem Azun


Abid Ali said:
Dear All

I want to call dopostback of parent window from child window.

Scenerio
I am opening window from a page, and i have datatable in session which is
updating at parent window and at child window both.
when I close the child window and reloads the parent window from javascript
it lost all information because it walks into
"Not Ispostback" condition para.

How i can reload the parent page which did not walk into this condition
para.

Regards
Abid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top