asp.net - window.opener.document.getElementById not working -


In my asp.net web application, I am creating a popup window with a button. When that button is clicked, I want to set the value of an asp: text box (id = text box 1) is rooted in the original window. However, it does not work like all the examples I read.

I have tried the following lines of code in my javascript onclick handler:

  1. window.opener.document.getElementById ('<% = TextBox1.ClientID% > '.value = "abc";
  2. window.opener.document.getElementById ("TextBox1"). Value = "ABC";
  3. window.opener.document.getElementById ("ctl00_ContentPlaceHolder1_TextBox1"). Value = "ABC";

The example 3 works only I have read that all things indicate that # 1 is the preferred way, but I can not do it at all.

thanks

thanks

for the popup window Is this line of JavaScript in markup? If so, the server-side code will not know that text box 1 is present on the server-side code for the original window, and its client ID will not be able to determine property. You must either pass that client ID in a popup window (query string, cookie, session, whatever) or hard code. Alternatively, you can put this line of JavaScript in a function on your parent page, and then you can make some calls with lines of windows. Operator Function (name).


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -