Link to home
Start Free TrialLog in
Avatar of attipa
attipaFlag for United States of America

asked on

passing an imageurl using window.opener.document.getElementById

i have two pages:

page-a.aspx
<asp:Image ID="Image1" runat="server />
<a href="#" onclick="window.open('pg-addimage.aspx?Image=Image1', 'addimagewindow', 'width=600px,height=450px,left=250px,top=150px,scrollbars=yes');return false;" class="admin-field-links">Add</a>

pg-addimage.aspx.vb
'when button is clicked
Response.Write("<script>window.opener.document.getElementById('ImageURL"').value =  & r("PGImageURL").ToString() & ";</script>")
Response.Write("<script>window.close();</script>")

how can i pass a value through to load an image on the parent page.  .imageurl and .value is not woring.
ASKER CERTIFIED SOLUTION
Avatar of rajapandian_81
rajapandian_81
Flag of India 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 attipa

ASKER

src didn't work.
Do you have Master Page for that opener page?
Avatar of attipa

ASKER

yes
Avatar of attipa

ASKER

look at code above that says page-a.aspx
If you have master page, the id of the control will not be same as which you gave. In run time the id of the control will be changed. In prefix it will add contentplaceholder's id.

For example if you have image id as Image1, in run time it will be changed something like ctl00_ContentPlaceHolder1_Image1. To find the id of your control in run time right click your page at run time and go to view source.

You have to use the id which is displayed in view source.

Here is the solved thread with the same problem.
https://www.experts-exchange.com/questions/24945521/Taking-Data-From-Pop-Up-Window-And-Filling-Textboxes-On-Main-Page-with-that-data.html
Avatar of attipa

ASKER

The image Id remains image1 in view source. I am not dynamically creating the image, it's hard coded so the id will not change.  
Avatar of attipa

ASKER

sorry...my mistake....i have to put '        '   around the actualy souce.