Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parent:child windows and state

Status
Not open for further replies.

tembalena

Programmer
Apr 17, 2001
37
ZA
I've got a parent window that has a few texboxes and a dropdownlist.
The user inputs text in the textboxes and then clicks a button to add a new item to the already populated dropdownlist.
Clicking on the button pops up a child window. Here the user adds a new item to the database.
And this is where the problem is...
When I close the child window, I need to keep the values already inputted on the parent window and just rebind the dropdownlist.
I've tried to do a form.submit() of the parent window while in the child window to force a postback, however this seems to just refresh the page.

Any help on this would be greatly appreciated.
Thanks.
 
Only in IE you can use modal dialog, the button that opens the popup should be a web button. Lets give this web button an id of "cmdPopup" When the page loads you can add some client script:
... page_load () handles page load
cmdPopup.attributes.add("onClick","return openPopup();")
...
Add some code for the click event of cmdPopup:
Private Sub cmdPopup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPopup.Click
' rebind your dropdown here
end sub


This is the client script on the page:
function openPopup(){
var ret = window.showModalDialog("popup.aspx",null,"dialogHeight:344px;dialogWidth:468px;help:0;resizable:0;scroll:0;status:0");
// this code won't execute until the popup is closed
// the following line causes the command button to submit the page so the server side cmdPopup click event will fire
return true;
}


If you want this to work for non IE browsers you have to simulate a modal dialog, there is some code on the Internet to simulate this (look for Netscape and modal dialog). Be aware though that all client code responding to html web controls have to be added with: control.attributes.add("event","some script")



Greetings, Harm Meijer
 
I tried this code but when the modal window closes a window re-opens as non modal. Can anyone help??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top