question

MeghaChourasiya-3269 avatar image
0 Votes"
MeghaChourasiya-3269 asked YijingSun-MSFT answered

Interaction between 2 window in MVC

I have one button 'btndetach' on AssignInvoice.cshtml page. i have one partial view _AssignInvoicePDF on AssignInvoice.cshtml page.

I am opening new window on btndetach button click event.

function DetachImage() {
window.open('@Url.Action("AssignInvoicePDF", "Invoice")', "PopupWindow", 'width=500px,height=500px,top=150,left=250');
}


On new window i am showing PartialView _AssignInvoicePDF.( same partial view which i have on Main Page - AssignInvoice)

Now my my requirement is when i select any option on new window then i can fetch those selected option on Main page as i have save button on main page.

So how can i communicate between new window and Main window.

Thanks.

dotnet-aspnet-mvc
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

So how can i communicate between new window and Main window.

Assign a reference to the window. See the JavaScript docs for more information.

 var winRef = window.open('@Url.Action("AssignInvoicePDF", "Invoice")', "PopupWindow", 'width=500px,height=500px,top=150,left=250');


0 Votes 0 ·

1 Answer

YijingSun-MSFT avatar image
0 Votes"
YijingSun-MSFT answered

Hi @MeghaChourasiya-3269 ,
As far as I think,you could add a method "SaveData" to window, so the child window can call parent method.
Just like this:
109200-new-text-document.txt
Best regards,
Yijing Sun


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.