Reputation: 1
In one view (view1) there is a text box and a button beside it. i click on that button, i am popping another view (Create view) as a seperate window. in create view i am entering some values and creating a record in db. out of these values one value i have to send back to "View1". how can i send this value...?
i am opening view2 from view1 like
<input type="button" value="Get ID"
onclick="window.open('<%=Url.Action("Create","Controller1") %>',
'','scrollbars=yes,width=800,height=800,resizable=yes');"
/>
View2 contains some fields like Name,Email etc... and I click "Create" to call HTTPPOST. there i add the values to db including a generated guid. i want to send this ID to view1.
Upvotes: 0
Views: 236
Reputation: 12028
Another option is to use javascript In view1
...
var popup = window.open("view2");
popup.opener = this
...
window.updateData = function(newValue){
alert(newValue);
}
in view2
window.opener.updateData(form.inputname.value);
========================================================
UPDATE:
After further information added to the question, I don't think this option would work easily and it will be easier to use Aliostad answer.
Upvotes: 0
Reputation: 81660
If these are not in the same window, there is no direct way.
However, when you popup second window, you can start polling your database using AJAX and when database change is done in the create view, your polling will return the value and update the view.
This is neither an MVC nor an ASP.NET question.
Upvotes: 1