In my asp.net web app, I create a popup window with a button. When that button is clicked, I want to set the value of an asp:TextBox (id=TextBox1) contained in the parent window. However, it doesn't work like all the examples I've read indicate. 

I've 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";

Only example 3 works. All the stuff I've read indicates that #1 is the preferred method, but I can't seem to make it work at all. Does anyone have any ideas what I'm doing wrong?

I've tried this in Firefox, Chrome and IE.

Thanks