I use the following methods to achieve a similar result to yours:
In the main page, I check to see if the browser can show a Modal window (basically, Internet Explorer), and if so, pop the new window as modal - this enables me to return a value directly back to the calling method, otherwise I just pop a new window and hope:
if (window.showModalDialog)
{
// showModalDialog returns a result, so pass that into the receiving funtion
// directly.
CallbackFunctionName(ShowModal(displayPath));
}
else
{
// Just use the standard window.open methods.
ShowWindow(displayPath);
}
function ShowWindow(displayPath)
{
var remoteWin=window.open(displayPath,"EditContact",
"resizable=yes,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,copyhistory=0,modal=yes,width="
+ dialogWidth + ",height=" + dialogHeight);
remoteWin.creator=self;
remoteWin.focus();
}
function ShowModal(displayPath)
{
return window.showModalDialog(displayPath, "editContact",
"center:yes;resizable:no;dialogWidth:" + dialogWidth +
"px;dialogHeight:" + dialogHeight + "px;");
}
Then, on the page that is opened, I again check for the ability to display a modal window, as before:
if(!window.showModalDialog)
{
// Call the callback method directly
window.opener.CallBackFunctionName(resultValue);
}
else
{
// Return the value back to the caller, who will pass the result along.
window.returnValue=resultValue;
}
self.close();
ASP.NET only messes with the control IDs in a known way - once the control has been loaded by the runtime on the server, you can retrieve the ClientID which will contain the runtime id of the control - you could either write this value into a JS variable, or use some JS to pick up the control value based on other features of the control.