attipa
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-a ddimage.as px?Image=I mage1', 'addimagewindow', 'width=600px,height=450px, left=250px ,top=150px ,scrollbar s=yes');re turn false;" class="admin-field-links"> Add</a>
pg-addimage.aspx.vb
'when button is clicked
Response.Write("<script>wi ndow.opene r.document .getElemen tById('Ima geURL"').v alue = & r("PGImageURL").ToString() & ";</script>")
Response.Write("<script>wi ndow.close ();</scrip t>")
how can i pass a value through to load an image on the parent page. .imageurl and .value is not woring.
page-a.aspx
<asp:Image ID="Image1" runat="server />
<a href="#" onclick="window.open('pg-a
pg-addimage.aspx.vb
'when button is clicked
Response.Write("<script>wi
Response.Write("<script>wi
how can i pass a value through to load an image on the parent page. .imageurl and .value is not woring.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you have Master Page for that opener page?
ASKER
yes
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
For example if you have image id as Image1, in run time it will be changed something like ctl00_ContentPlaceHolder1_
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
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.
ASKER
sorry...my mistake....i have to put ' ' around the actualy souce.
ASKER