views:

113

answers:

2

Hi all,

I'm currently building an app where i need somewhat of a lookup control. How this would work is that there is a texbox with a lookup button on a form. The user can either type in a value for the textbox or can choose the lookup button. When the user presses the lookup button a javascript window with a gridview and a list of columns appears. What i'd like to do is allow the lookup window to pass back the selected gridview value to the textbox on the first page and disable the textbox.

Can anyone help me with an example or so of how to go about doing this?

Thanks in advance

A: 

If you opening a window with window.open() you could just access opener object which points to the opening window and access it's dom/jhavascipt functions. // in window var retVal = ... opener.MyFunction(retVal) this.close()

// in main page
var valFromWindow = null;
function MyFunction(val)
{
   valFromWindow = val;
}

If you opening a window by making a hidden div visible, then you can just use any javascript you have in current window.

If you opening a window with window.showModalDialog you can pass back value using returnValue property. window.returnValue = "myretval" // in modal dialog

var retval = window.showModalDialog(...) // in main window
Alex Reitbort
+1  A: 

this might help

Canavar