Postback to a web custom control HELP Please!!!

Discussion in 'ASP .Net Building Controls' started by Chris, Apr 15, 2004.

  1. Chris

    Chris Guest

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

    Thanks in advance.
    Chris, Apr 15, 2004
    #1
    1. Advertising

  2. Chris

    Bento Guest

    Can you mention specific question clearly by sample ?
    Bento, Apr 16, 2004
    #2
    1. Advertising

  3. Chris

    Chris Guest

    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.

    "Bento" <> wrote in message news:...
    > Can you mention specific question clearly by sample ?
    Chris, Apr 16, 2004
    #3
  4. 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"
    <> wrote in message
    news:...
    > Can you mention specific question clearly by sample ?
    Fred Hirschfeld, Apr 16, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stan Sainte-Rose

    PostBack Within web custom control

    Stan Sainte-Rose, Sep 7, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    336
    Stan Sainte-Rose
    Sep 7, 2004
  2. gce
    Replies:
    2
    Views:
    1,681
  3. KK
    Replies:
    2
    Views:
    500
    Big Brian
    Oct 14, 2003
  4. Matt Sokol
    Replies:
    2
    Views:
    359
    Theo Tillotson
    Aug 7, 2003
  5. Chris

    postback to a web custom control Help!!!

    Chris, Apr 15, 2004, in forum: ASP .Net Web Controls
    Replies:
    7
    Views:
    122
    Fred Hirschfeld
    Apr 21, 2004
Loading...

Share This Page