I need to pass textbox value from redirected page into main page using javascript.On clicking 'select' button in findzipcode.cstml values from textbox are not passed into mainpage.cshtml.
FindZipCodeDetails.cshtml:
function SendValueToParentZipCodeInfo() {
var myVal1 = document.getElementById('ZipCodetxt').value;
var myVal5 = document.getElementById('Citytxt').value;
var myVal3 = document.getElementById('statenametxt').value;
window.opener.GetValueFromChildZip(myVal1);
window.opener.GetValueFromChildCity(myVal5);
window.opener.GetValueFromChildState(myVal3);
window.close();
return false;
}
| ZipCode | CityName | StateCode |
|---|---|---|
| @items.ZipCode | @items.CityName | @items.StateCode |
MainPage.cshtml
function GetValueFromChildZip(myVal1) {
document.getElementById('ZipCodetxt').value = myVal1;
}
function GetValueFromChildCity(myVal5) {
document.getElementById('Citytxt').value = myVal5;
}
function GetValueFromChildState(myVal3) {
document.getElementById('statenametxt').value = myVal3;
}
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ravi Polara PatidarPosted Dec 8, 2017, 4:16 AM