Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i have an aspx page and when i click on button i need to open another url's page in window.open whick looks like a popup( what exactly my requirement is when i click on button the parent page should not be enable). And when i click on submit button on my popup window i need to send url and image to the another url which is a part of parent website page.
process should look like here:


parentpage1.aspx(www.xyz.com/parentpage1.aspx) -------> popup window page(www.123.com/child.aspx) ----->
parentpage2.aspx(www.xyz.com/parentpage2.aspx)


Popup window page is need toopen in window.open and background should disable

actually i am trying with lightbox also but it's not working.
And i tried with model popup also but i am unable to send data from popup to page(the data is url only )
XML
var navUrl = '<%=Session["ReturnUrl"] %>' + "?Qty=" + qty + '&ThumbnailUrl=' + '<%=ViewState["Thumbnail"]%>' + "&ItemNumber=" + '<%=ViewState["Document"]%>' + "&Action=" + '<%=ViewState["Action"]%>';

       window.opener.location.href = navUrl;

here the importent thing is the URL i am sending is like this below:
<br />
http://localhost:56595/Success.aspx?Qty=1&amp;ThumbnailUrl=http://honnex1-pc/JesusChristImg/pdfTojpg/LivingWater_LF1110201321117902.jpg&amp;ItemNumber=D20131011153145960&amp;Action=Create

Thanks in advance,
Regards,
Neimish Varaprasad.Suggala
Posted
Updated 11-Oct-13 0:05am
v3

Hi,
JavaScript
var navUrl = '<%=Session["ReturnUrl"] %>' + "?Qty=" + qty + '&ThumbnailUrl=' + '<%=ViewState["Thumbnail"]%>' + "&ItemNumber=" + '<%=ViewState["Document"]%>' + "&Action=" + '<%=ViewState["Action"]%>'; 
window.opener.location.href = navUrl;

The above code will not set the values of querystring parameters until you make a postback.

Now, you are specifying the href of the parent page. After the postback you will have to refresh the parent page. I think it is a wrong approach.

Coming to your requirement:

Your requirement is to disable the parent page as long as the child page is kept opened. Basically these popups are known as modal popups. Opening a window using window.open() method do not disable the parent page by default. You will have to handle a lot of things in that case. Disabling parent window, opening child window, handling the focus on the child window so that the user never lose the focus and stay on the page etc. A simple solution would be to use JQuery plugin that loads the external contents into the modal div. After that you can manipulate the DOM elements from the same page. You can use one of these:

Magnific Popup[^]

bPopup[^]

I hope it helps.
 
Share this answer
 
v2
Hey there,

I have created an example for you, I hope this is what you were looking for:
In this example, I have two Pages, ParentTest1.aspx and ParentTest2.aspx, and the page that will open in popup is MyPopup.aspx,

Ok I have a Button and the JavaScript to open the popup in ParentTest1.aspx:
ParentTest1.aspx:
ASP.NET
<asp:button runat="server" id="BtnPopUp" text="Open Popup" onclientclick="return OpenPopup(); " xmlns:asp="#unknown" />

JavaScript
function  OpenPopup() {
             var returnValue = window.showModalDialog("MyPopup.aspx?Qty=1&ThumbnailUrl=http://honnex1-pc/JesusChristImg/pdfTojpg/LivingWater_LF1110201321117902.jpg&ItemNumber=D20131011153145960&Action=Create", "", "Height:500, width:500;");
             window.location = returnValue.MyURL;
             
             return false;
         }

I have a button to submit and JavaScript function to return a URL to open ParentTest2.aspx on MyPopup.aspx page.
MyPopup.aspx:
ASP.NET
<asp:button runat="server" id="BtnSubmit" text="Submit" onclientclick="return OK();" xmlns:asp="#unknown" />

JavaScript
function OK() {
             var vReturnValue = new Object();
             vReturnValue.MyURL = "ParentTest2.aspx?ID=AnyValue";
             window.returnValue = vReturnValue;
             window.close();
             return false;
         } 


Try it and let me know if it helps.

Azee...
 
Share this answer
 
hi azee,
i need just design only actually my code is working with window.open() but i have a requirement only window.open() with disabling parent page, my requirement is almost like what jafar has said..
Thank u Azee and Jafar. Jafar if possible can you please tell me what i have to do for this ( Disabling parent window, opening child window, handling the focus on the child window)..
Thanks
Neimish varaprasad.Suggala
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900