Link to home
Start Free TrialLog in
Avatar of ceema
ceema

asked on

window.opener function

Hello,

I am using the following code to pass data from a prent window to a child window(I am using aspx). For that I am using the code in my aspx page. In my aspx page of parent, I am having two fileds TxtRegNo as text box, and T1 as list box. To my textbox, I am getting the exact value, but to my list box, it's showing error, can any one help me, to pass value to my listbox in aspx page.

Thnaks
Ceema


Code:

<head>
            <SCRIPT language="JavaScript">
<!--

function pick(RegNo,SName,LClass) {
  if (window.opener && !window.opener.closed)
    window.opener.document.Form1.TxtRegNo.value = RegNo;
   window.opener.document.Form1.T1.value = LClass;
   alert(LClass);
   
 window.close();
 
}

// -->
            </SCRIPT>
      </HEAD>



Actually my LClass is the value I am getting after reading the database. for example...

I have three classes in my table ClassDetails

ClassID    ClassName

203            1-A
208            3-B
509            3-A

In LClass, I am getting 208 for example. So

window.opener.document.Form1.T1.value = 208. Now my parent window, I have a list box having all these three values, my aim is to disply 3-B as seleted in the parent window, with the other values also in list box.

If some one can help me, I am so thankful.

I have tried window.opener.document.Form1.LYear.options[LYear].selected, but in some cases it's not working


Thank you once again,
Ceema
SOLUTION
Avatar of basicinstinct
basicinstinct
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ceema
ceema

ASKER

Hello basicinstinct,mplungjan,

   Thank you for the reply. Both are working fine, but second one is little bit faster I think. Thank you so much for the help. I am spliting the points.

Thank you so once again  for the solution.

Regards
Ceema