Postback to a web custom control HELP Please!!!

C

Chris

Does anyone know how to postback to an inherited custom control from a
pop-up window?

Thanks in advance.
 
C

Chris

Bento-

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.
 
F

Fred Hirschfeld

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>
Now your script would use the method window.returnValue [ = vValue ] to
return a value (or javascript Object like is shown above) to the parent.
This value of object can be accessed through the retVal variable on return
of the dialog.Hope this helps, let me know.Fred"Bento"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top