neilault
Newcomer
Hi,
I currently have a web user control (pf_imageselector.ascx) which is dynamically created (any number of times) on a parent web user control (pf_fillitems.ascx) which in turn has been loaded into a webform (default.aspx). On the user control is a text box called txbSelectedImage and a button. On click of the button run's this code:
function OpenChild()
{
var strImageFile;
var WinSettings = "height=580,width=630,status=yes,toolbar=no,menubar=no,location=no";
window.open("pf_stockimage.aspx", null, WinSettings);
}
Which obviously open a child webform. From here the user can select something from a listbox and the click another button, which then hopefully passes back the selected value to the textbox on the parent user control. Code so far is:
function PassSelectedImage()
{
var lstImages = document.forms[0].lstImages;
var i = lstImages.selectedIndex;
window.opener.document.forms[0].txbSelectedImage.value = lstImages.options.value;
window.close();
}
My problem is that I get an erorr stating that above is null or not an object. How do I reference the textbox that is sitting inside the user control (ID is generated at runtime), which is also sittting in another usercontrol (I know the ID of this one) on a webform (default.aspx, which as a form called Form1).
I currently have a web user control (pf_imageselector.ascx) which is dynamically created (any number of times) on a parent web user control (pf_fillitems.ascx) which in turn has been loaded into a webform (default.aspx). On the user control is a text box called txbSelectedImage and a button. On click of the button run's this code:
function OpenChild()
{
var strImageFile;
var WinSettings = "height=580,width=630,status=yes,toolbar=no,menubar=no,location=no";
window.open("pf_stockimage.aspx", null, WinSettings);
}
Which obviously open a child webform. From here the user can select something from a listbox and the click another button, which then hopefully passes back the selected value to the textbox on the parent user control. Code so far is:
function PassSelectedImage()
{
var lstImages = document.forms[0].lstImages;
var i = lstImages.selectedIndex;
window.opener.document.forms[0].txbSelectedImage.value = lstImages.options.value;
window.close();
}
My problem is that I get an erorr stating that above is null or not an object. How do I reference the textbox that is sitting inside the user control (ID is generated at runtime), which is also sittting in another usercontrol (I know the ID of this one) on a webform (default.aspx, which as a form called Form1).