Hi All,
First of all let me explain about my previous post.
As everybody knows Client script executes first then only follows serverside code.
By using window.showModalDialog for open child popup ,it waits for that chld return value and then executes remaining client side code and then server side exode executes for that button.
As NC01 told that window.showModalDialog work only for IE and that posted solution was good.
Also Iam suggesting a simle way without using sessions
Look at the following also...
ParentPage is like this...
<form id="form1" runat="server">
<div>
<input type="hidden" id="hidden1" runat="server" /> <br />
<input type="button" id="btnOpenChild" value="Open" runat="server" onclick="return window.open('Child.aspx');return false;" />
<input type="button" id="btnhidOpenChild" runat="Server" style="display:none" onserverclick="btnOpenChild_click" />
</div>
</form>
Code behind for ParentPage..
protected void btnOpenChild_click(object sender, EventArgs e)
{
string str;
str = this.hidden1.Value;
Response.Write(str);
}
and Child Page ...
<form id="form1" runat="server">
<div>
<input type="text" id="txtchild" runat="server" /> <br />
<input type="button" id="btnOpenChild" runat="server" value="Close" onclick="return PopupClose();return false;" />
</div>
</form>
Javascript for ChildPage..
function PopupClose()
{
var sValue=document.getElementById('txtchild').value;
if(sValue!=null && sValue!="")
{
window.opener.document.getElementById('hidden1').value=sValue;
window.opener.document.getElementById('btnhidOpenChild').click();
window.close();
}
}
Nothing is new here...I just called that Parentpage button click event in child page...
Let us know if You have any concerns on this...
Regards,
Satish