Depends on your custom control. I am assuming that you are posting the page back to the server and just want to be able to access the value of the custom control (which would be the return value of the popup). Is this correct?
I am still not clear how you are intending the post back to happen...
I would expect that your custom control being used on a page would emit various client side javascript code to popup a dialog window. Then after the user enters the information into this window, they would click a button that would fire a javascript event in the popup page that would set the window.returnValue to whatever the input is expecting. If this is a textarea, then it would set the returnValue to the textarea.value. Then the script would call window.close().
Once this is done you will have that value returned to you through the vReturnValue variable as shown in the code below. With this you can use the javascript to set a hidden variable on the main pages form to be posted back to the server.
If you are doing custom rendering, you must ensure the HTML element you create as part of your custom control has the NAME attribute that is the same as the ID of the server control so you get the value posted back properly.
I am still shooting in the dark unless you can post some code of your control or aspx page. If you would like to e-mail this instead, then send it to fred_hirschfeld at hotmail dot com.
Fred
The Dialog pop works fine and I can pass data to the popup page but I need to post the result back to the server.
This page is being generated from a class(Custom Control")
Therefore how would I ignore other page postbacks and just capture the contents ("textarea") of the poppage and fire dataupdate form the control or a nother componenet.
well, you would need to update that script (if not only supporting IE) to do:
var newWin = window.open(...);
newWin.opener = window; // make sure the opener property has the parent window
IE Does have a method to open a dialog but this won't work for netscape... if you only have to deal with IE, then you can use the modal dialog stuff and it will send you a result of your choosing. Then you can place the results in a hidden field of your control or what ever element you have on the parent form.
So instead of the above, you could use:
vReturnValue = window.showModalDialog(sURL [, vArguments] [, sFeatures])
where the vArguments can be a single parameter or an array of parameters to pass to the dialog window.
Calling page:
<HTML>
<HEAD>
<SCRIPT>
function fnLaunch()
{
var aForm;
aForm = oForm.elements;
var myObject = new Object();
myObject.firstName = aForm.oFirstName.value;
myObject.lastName = aForm.oLastName.value;
// The object "myObject" is sent to the modal window.
var retVal = window.showModalDialog("modalDialogSource.htm", myObject, "dialogHeight:300px; dialogLeft:200px;");
}
</SCRIPT>
</HEAD>
<BODY>
<BUTTON onclick="fnLaunch();" >Launch The Window</BUTTON>
<FORM ID= "oForm">
First Name:
<INPUT TYPE="text" NAME="oFirstName" VALUE="Jane">
<BR>
Last Name:
<INPUT TYPE="text" NAME="oLastName" VALUE="Smith">
</FORM>
</BODY>
</HTML>
Dialog Page:
<HTML>
<HEAD>
<SCRIPT>
var oMyObject = window.dialogArguments;
var sFirstName = oMyObject.firstName;
var sLastName = oMyObject.lastName;
</SCRIPT>
<title>Untitled</title>
</head>
<BODY STYLE="font-family: arial; font-size: 14pt; color: Snow;
background-color: RosyBrown;">
First Name:
<SPAN STYLE="color:00ff7f">
<SCRIPT>
document.write(sFirstName);
</SCRIPT>
</SPAN>
<BR>
Last Name:
<SPAN STYLE="color:00ff7f">
<SCRIPT>
document.write(sLastName);
</SCRIPT>
</SPAN>
</BODY>
</HTML>
Fred-
This is the code that produces an aspx,asp or html page to the client this pages data needs to be submitted back to the server to be processed.
I would prefer to lock the main page as in a modal dialog in windows until the pop-up window is closed and also handle postback either to my control on the main page or another assembly that can be installed on the web server with my control. Any ideas are greatly appreciated.
Me.Page.Response.Write("<script language='JavaScript'> itemWidth=400; itemHeight=400; w = screen.width; h = screen.height; l=(w-itemWidth)/2; t=(h-itemHeight)/2; void window.open('" & URL & "', '" & sMode & "', 'toolbar=0, directories=0,status=0,menuBar=0,scrollBars=0,resizable=0, width='+itemWidth+', height='+itemHeight+', top='+t+', left='+l)</script>")
Thanks.