Click here to Skip to main content
15,920,896 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
In my web application iam using the following javascript code for to set the values in pop up window to main window.
To set the values in list box[PopUp Window]
var  frm_bank = document.forms['form1'].elements;
var ind = frm_bank['lst_bankname'].selectedIndex;
var  b_code = frm_bank['lst_bankname'].options[ind].value;
var  bankname=frm_bank['lst_bankname'].options[ind].text;


and to assign this values to dropdown list[Main Window] the following code is used
window.opener.document.getElementById('ctl00_ContentPlaceHolder1_ddl_bankcode').options[0].value =b_code;
window.opener.document.getElementById('ctl00_ContentPlaceHolder1_ddl_bankcode').options[0].text =bankname;

and the following code is used to call the SelectedIndexChanged event of dropdown list
window.opener.document.getElementById('ctl00_ContentPlaceHolder1_ddl_bankcode').onchange();


It is working fine for first time.after post back it is not worked.if the code
window.opener.document.getElementById('ctl00_ContentPlaceHolder1_ddl_bankcode').onchange();

is not used it works fine all the timew.but i want to work it also.javascript is called and the values bankname,b_code are correct at second time also but it is not set to dropdownlist
What is the problem with it Please help me to solve it
Posted
Updated 18-Mar-11 2:26am
v2

1 solution

The first thing I would recommend is start using JQuery rather than hand coding it as you are. You can use CSS selectors to access the elements without the need for the ASP.NET mangled names to ensure you are getting the correct element. JQuery also has a better mechanism to hookup events.
 
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