Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello,
I want to assign a value to my parent popup window's textbox. I am able to check an element exists in the parent popup or not but I can't assign the value to it. Please help. Any clue or link will help me.

ASP.NET
<asp:TextBox ID="txtfolio" runat="server" ReadOnly="true" CssClass="input" MaxLength="150" name="txtfolio" Width="200px" />


JavaScript
var folio = window.parent.document.getElementsByName("txtfolio");
folio.value = 'somevalues';


Now. if I alert(folio) it throws object NodeList then folio.value = 'somevalue' not working at all. Any suggestion for this?

What I have tried:

JavaScript
folio.value = 'somevalue'
Posted
Updated 19-Jan-22 19:54pm
v2
Comments
Chris Copeland 17-Jan-22 8:06am    
I've answered this question on the previous question you submitted a while ago:

How to check an element exists in a parent window using javascript

1 solution

These ids don't match:
window.parent.document.getElementsByName("txtfolio");

ID="txtPortfolio"


Also the asp:Textbox ID may be altered when the page is rendered. Try adding ClientIDMode="Static" to the asp:Textbox.
 
Share this answer
 
Comments
Member 14362033 20-Jan-22 1:55am    
Hello LesF, I will try your solution. Thanks

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